Cuberite
A lightweight, fast and extensible game server for Minecraft
|
Same thing as cCallback, but GetStackValue() won't fail if the callback value is nil. More...
#include <LuaState.h>
Public Member Functions | |
cOptionalCallback (void) | |
bool | RefStack (cLuaState &a_LuaState, int a_StackPos) |
Set the contained callback to the function in the specified Lua state's stack position. More... | |
Public Member Functions inherited from cLuaState::cCallback | |
template<typename... Args> | |
bool | Call (Args &&... args) |
Calls the Lua callback, if still available. More... | |
cCallback (void) | |
bool | RefStack (cLuaState &a_LuaState, int a_StackPos) |
Set the contained callback to the function in the specified Lua state's stack position. More... | |
Public Member Functions inherited from cLuaState::cTrackedRef | |
void | Clear (void) |
Frees the contained reference, if any. More... | |
cTrackedRef (void) | |
Creates an unbound ref instance. More... | |
bool | IsSameLuaState (cLuaState &a_LuaState) |
Returns true if the reference resides in the specified Lua state. More... | |
bool | IsValid (void) |
Returns true if the contained reference is valid. More... | |
bool | RefStack (cLuaState &a_LuaState, int a_StackPos) |
Set the contained reference to the object at the specified Lua state's stack position. More... | |
~cTrackedRef () | |
Protected Member Functions | |
cOptionalCallback (const cOptionalCallback &)=delete | |
This class cannot be copied, because it is tracked in the LuaState by-ptr. More... | |
cOptionalCallback (cOptionalCallback &&)=delete | |
This class cannot be moved, because it is tracked in the LuaState by-ptr. More... | |
Protected Member Functions inherited from cLuaState::cCallback | |
cCallback (cCallback &&)=delete | |
This class cannot be moved, because it is tracked in the LuaState by-ptr. More... | |
cCallback (const cCallback &)=delete | |
This class cannot be copied, because it is tracked in the LuaState by-ptr. More... | |
Protected Member Functions inherited from cLuaState::cTrackedRef | |
cTrackedRef (const cTrackedRef &)=delete | |
This class cannot be copied, because it is tracked in the LuaState by-ptr. More... | |
cTrackedRef (cTrackedRef &&)=delete | |
This class cannot be moved, because it is tracked in the LuaState by-ptr. More... | |
cRef & | GetRef () |
Returns the internal reference. More... | |
void | Invalidate (void) |
Invalidates the callback, without untracking it from the cLuaState. More... | |
Private Types | |
using | Super = cCallback |
Additional Inherited Members | |
Protected Attributes inherited from cLuaState::cTrackedRef | |
std::atomic< cCriticalSection * > | m_CS |
The mutex protecting m_Ref against multithreaded access. More... | |
cRef | m_Ref |
Reference to the Lua callback. More... | |
Same thing as cCallback, but GetStackValue() won't fail if the callback value is nil.
Used for callbacks that are optional - they needn't be present and in such a case they won't get called.
Definition at line 332 of file LuaState.h.
|
private |
Definition at line 335 of file LuaState.h.
|
inline |
Definition at line 339 of file LuaState.h.
|
protecteddelete |
This class cannot be copied, because it is tracked in the LuaState by-ptr.
Use cCallbackPtr for a copyable object.
|
protecteddelete |
This class cannot be moved, because it is tracked in the LuaState by-ptr.
Use cCallbackPtr for a copyable object.
bool cLuaState::cOptionalCallback::RefStack | ( | cLuaState & | a_LuaState, |
int | a_StackPos | ||
) |
Set the contained callback to the function in the specified Lua state's stack position.
If a callback has been previously contained, it is unreferenced first. Returns true on success, false on failure (not a function at the specified stack pos).
Definition at line 337 of file LuaState.cpp.