Cuberite
A lightweight, fast and extensible game server for Minecraft
|
Used for storing references to object in the global registry. More...
#include <LuaState.h>
Public Member Functions | |
template<typename T > | |
void | CreateFromObject (cLuaState &a_LuaState, T &&a_Object) |
Creates a Lua reference to the specified object instance in the specified Lua state. More... | |
cRef (cLuaState &a_LuaState, int a_StackPos) | |
Creates a reference in the specified LuaState for object at the specified StackPos. More... | |
cRef (cRef &&a_FromRef) | |
Moves the reference from the specified instance into a newly created instance. More... | |
cRef (void) | |
Creates an unbound reference object. More... | |
lua_State * | GetLuaState (void) |
Returns the Lua state associated with the value. More... | |
bool | IsValid (void) const |
Returns true if the reference is valid. More... | |
operator int (void) const | |
Allows to use this class wherever an int (i. More... | |
void | RefStack (cLuaState &a_LuaState, int a_StackPos) |
Creates a reference to Lua object at the specified stack pos, binds this object to it. More... | |
void | UnRef (void) |
Removes the bound reference, resets the object to Unbound state. More... | |
~cRef () | |
Protected Member Functions | |
cRef (const cRef &)=delete | |
Protected Attributes | |
lua_State * | m_LuaState |
int | m_Ref |
Used for storing references to object in the global registry.
Can be bound (contains a reference) or unbound (doesn't contain reference). The reference can also be reset by calling RefStack().
Definition at line 159 of file LuaState.h.
cLuaState::cRef::cRef | ( | void | ) |
Creates an unbound reference object.
Definition at line 2588 of file LuaState.cpp.
cLuaState::cRef::cRef | ( | cLuaState & | a_LuaState, |
int | a_StackPos | ||
) |
Creates a reference in the specified LuaState for object at the specified StackPos.
Definition at line 2598 of file LuaState.cpp.
cLuaState::cRef::cRef | ( | cRef && | a_FromRef | ) |
Moves the reference from the specified instance into a newly created instance.
The old instance is then "!IsValid()".
Definition at line 2609 of file LuaState.cpp.
cLuaState::cRef::~cRef | ( | ) |
Definition at line 2621 of file LuaState.cpp.
|
protecteddelete |
|
inline |
Creates a Lua reference to the specified object instance in the specified Lua state.
This is useful to make anti-GC references for objects that were created by Lua and need to stay alive longer than Lua GC would normally guarantee.
Definition at line 192 of file LuaState.h.
|
inline |
Returns the Lua state associated with the value.
Definition at line 188 of file LuaState.h.
|
inline |
Returns true if the reference is valid.
Definition at line 182 of file LuaState.h.
|
inlineexplicit |
Allows to use this class wherever an int (i.
e. ref) is to be used
Definition at line 185 of file LuaState.h.
void cLuaState::cRef::RefStack | ( | cLuaState & | a_LuaState, |
int | a_StackPos | ||
) |
Creates a reference to Lua object at the specified stack pos, binds this object to it.
Calls UnRef() first if previously bound to another reference.
Definition at line 2633 of file LuaState.cpp.
void cLuaState::cRef::UnRef | ( | void | ) |
Removes the bound reference, resets the object to Unbound state.
Definition at line 2650 of file LuaState.cpp.
|
protected |
Definition at line 200 of file LuaState.h.
|
protected |
Definition at line 201 of file LuaState.h.