Cuberite
A lightweight, fast and extensible game server for Minecraft
|
Represents a table on the Lua stack. More...
#include <LuaState.h>
Public Member Functions | |
cStackTable (cLuaState &a_LuaState, int a_StackPos) | |
void | ForEachArrayElement (cFunctionRef< bool(cLuaState &a_LuaState, int a_Index)> a_ElementCallback) const |
Iterates over all array elements in the table consecutively and calls the a_ElementCallback for each. More... | |
void | ForEachElement (cFunctionRef< bool(cLuaState &a_LuaState)> a_ElementCallback) const |
Iterates over all dictionary elements in the table in random order, and calls the a_ElementCallback for each of them. More... | |
cLuaState & | GetLuaState (void) const |
Protected Attributes | |
cLuaState & | m_LuaState |
The Lua state in which the table resides. More... | |
int | m_StackPos |
The stack index where the table resides in the Lua state. More... | |
Represents a table on the Lua stack.
Provides easy access to the elements in the table. Note that this class doesn't have cTrackedRef's thread-safeness and unload-safeness, it is expected to be used for immediate queries in API bindings.
Definition at line 515 of file LuaState.h.
cLuaState::cStackTable::cStackTable | ( | cLuaState & | a_LuaState, |
int | a_StackPos | ||
) |
Definition at line 375 of file LuaState.cpp.
void cLuaState::cStackTable::ForEachArrayElement | ( | cFunctionRef< bool(cLuaState &a_LuaState, int a_Index)> | a_ElementCallback | ) | const |
Iterates over all array elements in the table consecutively and calls the a_ElementCallback for each.
The callback receives the LuaState in which the table resides, and the element's index. The LuaState has the element on top of its stack. If the callback returns true, the iteration is aborted, if it returns false, the iteration continues with the next element.
Definition at line 386 of file LuaState.cpp.
void cLuaState::cStackTable::ForEachElement | ( | cFunctionRef< bool(cLuaState &a_LuaState)> | a_ElementCallback | ) | const |
Iterates over all dictionary elements in the table in random order, and calls the a_ElementCallback for each of them.
The callback receives the LuaState in which the table reside. The LuaState has the element on top of its stack, and the element's key just below it. If the callback returns true, the iteration is aborted, if it returns false, the iteration continues with the next element.
Definition at line 409 of file LuaState.cpp.
|
inline |
Definition at line 533 of file LuaState.h.
|
protected |
The Lua state in which the table resides.
Definition at line 537 of file LuaState.h.
|
protected |
The stack index where the table resides in the Lua state.
Definition at line 540 of file LuaState.h.