xoreos
0.0.5
|
A reference to a Lua table. More...
#include <table.h>
Public Member Functions | |
TableRef () | |
TableRef (const Stack &stack, int index) | |
TableRef (lua_State &state, int index) | |
TableRef (const TableRef &table) | |
~TableRef () | |
const TableRef & | operator= (const TableRef &table) |
int | getSize () const |
Return the number of elements in the table. More... | |
Common::UString | getExactType () const |
TableRef | getMetaTable () const |
void | setMetaAccessEnabled (bool enabled) |
Enable/Disable access to the table elements using metamethods. More... | |
bool | isMetaAccessEnabled () const |
void | removeAt (int index) |
void | removeAt (const Common::UString &key) |
void | setBooleanAt (int index, bool value) |
void | setBooleanAt (const Common::UString &key, bool value) |
void | setFloatAt (int index, float value) |
void | setFloatAt (const Common::UString &key, float value) |
void | setIntAt (int index, int value) |
void | setIntAt (const Common::UString &key, int value) |
void | setStringAt (int index, const char *value) |
void | setStringAt (const Common::UString &key, const char *value) |
void | setStringAt (int index, const Common::UString &value) |
void | setStringAt (const Common::UString &key, const Common::UString &value) |
void | setTableAt (int index, const TableRef &value) |
void | setTableAt (const Common::UString &key, const TableRef &value) |
void | setFunctionAt (int index, const FunctionRef &value) |
void | setFunctionAt (const Common::UString &key, const FunctionRef &value) |
void | setUserTypeAt (int index, void *value, const Common::UString &type) |
Push a usertype value onto the stack. More... | |
void | setUserTypeAt (const Common::UString &key, void *value, const Common::UString &type) |
void | setVariableAt (int index, const Variable &value) |
void | setVariableAt (const Common::UString &key, const Variable &value) |
bool | getBooleanAt (int index) const |
bool | getBooleanAt (const Common::UString &key) const |
float | getFloatAt (int index) const |
float | getFloatAt (const Common::UString &key) const |
int | getIntAt (int index) const |
int | getIntAt (const Common::UString &key) const |
Common::UString | getStringAt (int index) const |
Common::UString | getStringAt (const Common::UString &key) const |
TableRef | getTableAt (int index) const |
TableRef | getTableAt (const Common::UString &key) const |
FunctionRef | getFunctionAt (int index) const |
FunctionRef | getFunctionAt (const Common::UString &key) const |
void * | getRawUserTypeAt (int index, const Common::UString &type="") const |
Return a usertype value at the given index in the stack. More... | |
void * | getRawUserTypeAt (const Common::UString &key, const Common::UString &type="") const |
template<typename T > | |
T * | getUserTypeAt (int index, const Common::UString &type="") const |
template<typename T > | |
T * | getUserTypeAt (const Common::UString &key, const Common::UString &type="") const |
Variable | getVariableAt (int index) const |
Variable | getVariableAt (const Common::UString &key) const |
Common::UString | getExactTypeAt (int index) const |
Common::UString | getExactTypeAt (const Common::UString &key) const |
Type | getTypeAt (int index) const |
Type | getTypeAt (const Common::UString &key) const |
Variables | getVariables () const |
bool | isNilAt (int index) const |
bool | isNilAt (const Common::UString &key) const |
bool | isBooleanAt (int index) const |
bool | isBooleanAt (const Common::UString &key) const |
bool | isNumberAt (int index) const |
bool | isNumberAt (const Common::UString &key) const |
bool | isStringAt (int index) const |
bool | isStringAt (const Common::UString &key) const |
bool | isTableAt (int index) const |
bool | isTableAt (const Common::UString &key) const |
bool | isFunctionAt (int index) const |
bool | isFunctionAt (const Common::UString &key) const |
bool | isUserTypeAt (int index, const Common::UString &type="") const |
Check whether the value at the given index is a usertype value. More... | |
bool | isUserTypeAt (const Common::UString &key, const Common::UString &type="") const |
lua_State & | getLuaState () const |
Return the underlying Lua state. More... | |
int | getRef () const |
Private Member Functions | |
void | pushSelf () const |
Private Attributes | |
lua_State * | _luaState |
The Lua state. More... | |
int | _ref |
bool | _metaAccessEnabled |
Aurora::Lua::TableRef::TableRef | ( | const Stack & | stack, |
int | index | ||
) |
Aurora::Lua::TableRef::TableRef | ( | lua_State & | state, |
int | index | ||
) |
Aurora::Lua::TableRef::TableRef | ( | const TableRef & | table | ) |
Aurora::Lua::TableRef::~TableRef | ( | ) |
bool Aurora::Lua::TableRef::getBooleanAt | ( | int | index | ) | const |
Definition at line 248 of file table.cpp.
References Aurora::Lua::Variable::getBool(), getVariableAt(), and isBooleanAt().
bool Aurora::Lua::TableRef::getBooleanAt | ( | const Common::UString & | key | ) | const |
Definition at line 256 of file table.cpp.
References Common::UString::c_str(), Aurora::Lua::Variable::getBool(), getVariableAt(), and isBooleanAt().
Common::UString Aurora::Lua::TableRef::getExactType | ( | ) | const |
Definition at line 107 of file table.cpp.
References _luaState, Aurora::Lua::Stack::getExactTypeAt(), and pushSelf().
Common::UString Aurora::Lua::TableRef::getExactTypeAt | ( | int | index | ) | const |
Definition at line 386 of file table.cpp.
References _luaState, Aurora::Lua::Stack::getExactTypeAt(), and pushSelf().
Referenced by isUserTypeAt().
Common::UString Aurora::Lua::TableRef::getExactTypeAt | ( | const Common::UString & | key | ) | const |
Definition at line 396 of file table.cpp.
References _luaState, _metaAccessEnabled, Common::UString::c_str(), Aurora::Lua::Stack::getExactTypeAt(), and pushSelf().
float Aurora::Lua::TableRef::getFloatAt | ( | int | index | ) | const |
Definition at line 264 of file table.cpp.
References Aurora::Lua::Variable::getFloat(), getVariableAt(), and isNumberAt().
float Aurora::Lua::TableRef::getFloatAt | ( | const Common::UString & | key | ) | const |
Definition at line 272 of file table.cpp.
References Common::UString::c_str(), Aurora::Lua::Variable::getFloat(), getVariableAt(), and isNumberAt().
FunctionRef Aurora::Lua::TableRef::getFunctionAt | ( | int | index | ) | const |
Definition at line 328 of file table.cpp.
References Aurora::Lua::Variable::getFunction(), getVariableAt(), and isFunctionAt().
Referenced by Aurora::Lua::ScriptManager::callFunction().
FunctionRef Aurora::Lua::TableRef::getFunctionAt | ( | const Common::UString & | key | ) | const |
Definition at line 336 of file table.cpp.
References Common::UString::c_str(), Aurora::Lua::Variable::getFunction(), getVariableAt(), and isFunctionAt().
int Aurora::Lua::TableRef::getIntAt | ( | int | index | ) | const |
Definition at line 280 of file table.cpp.
References Aurora::Lua::Variable::getInt(), getVariableAt(), and isNumberAt().
int Aurora::Lua::TableRef::getIntAt | ( | const Common::UString & | key | ) | const |
Definition at line 288 of file table.cpp.
References Common::UString::c_str(), Aurora::Lua::Variable::getInt(), getVariableAt(), and isNumberAt().
lua_State & Aurora::Lua::TableRef::getLuaState | ( | ) | const |
TableRef Aurora::Lua::TableRef::getMetaTable | ( | ) | const |
Definition at line 116 of file table.cpp.
References _luaState, Aurora::Lua::Stack::getTableAt(), and pushSelf().
Referenced by Aurora::Lua::ScriptManager::injectNewIndexMetaEventIntoTable().
void * Aurora::Lua::TableRef::getRawUserTypeAt | ( | int | index, |
const Common::UString & | type = "" |
||
) | const |
Return a usertype value at the given index in the stack.
If type is not empty, perform a type check.
Definition at line 344 of file table.cpp.
References Aurora::Lua::Variable::getRawUserType(), getVariableAt(), and isUserTypeAt().
Referenced by Aurora::Lua::getRawCppObjectFromStack(), Aurora::Lua::getRawCppObjectFromVariable(), and getUserTypeAt().
void * Aurora::Lua::TableRef::getRawUserTypeAt | ( | const Common::UString & | key, |
const Common::UString & | type = "" |
||
) | const |
Definition at line 352 of file table.cpp.
References Common::UString::c_str(), Aurora::Lua::Variable::getRawUserType(), getVariableAt(), and isUserTypeAt().
int Aurora::Lua::TableRef::getRef | ( | ) | const |
Definition at line 522 of file table.cpp.
References _ref.
Referenced by Aurora::Lua::Stack::pushTable().
int Aurora::Lua::TableRef::getSize | ( | ) | const |
Return the number of elements in the table.
Definition at line 94 of file table.cpp.
References _luaState, and pushSelf().
Common::UString Aurora::Lua::TableRef::getStringAt | ( | int | index | ) | const |
Definition at line 296 of file table.cpp.
References Aurora::Lua::Variable::getString(), getVariableAt(), and isStringAt().
Common::UString Aurora::Lua::TableRef::getStringAt | ( | const Common::UString & | key | ) | const |
Definition at line 304 of file table.cpp.
References Common::UString::c_str(), Aurora::Lua::Variable::getString(), getVariableAt(), and isStringAt().
TableRef Aurora::Lua::TableRef::getTableAt | ( | int | index | ) | const |
Definition at line 312 of file table.cpp.
References Aurora::Lua::Variable::getTable(), getVariableAt(), and isTableAt().
Referenced by Aurora::Lua::ScriptManager::callFunction().
TableRef Aurora::Lua::TableRef::getTableAt | ( | const Common::UString & | key | ) | const |
Definition at line 320 of file table.cpp.
References Common::UString::c_str(), Aurora::Lua::Variable::getTable(), getVariableAt(), and isTableAt().
Type Aurora::Lua::TableRef::getTypeAt | ( | int | index | ) | const |
Definition at line 412 of file table.cpp.
References _luaState, Aurora::Lua::Stack::getTypeAt(), and pushSelf().
Referenced by isBooleanAt(), isFunctionAt(), isNilAt(), isNumberAt(), isStringAt(), isTableAt(), and isUserTypeAt().
Type Aurora::Lua::TableRef::getTypeAt | ( | const Common::UString & | key | ) | const |
Definition at line 422 of file table.cpp.
References _luaState, _metaAccessEnabled, Common::UString::c_str(), Aurora::Lua::Stack::getTypeAt(), and pushSelf().
|
inline |
Definition at line 152 of file table.h.
References getRawUserTypeAt().
|
inline |
Definition at line 157 of file table.h.
References getRawUserTypeAt().
Variable Aurora::Lua::TableRef::getVariableAt | ( | int | index | ) | const |
Definition at line 360 of file table.cpp.
References _luaState, Aurora::Lua::Stack::getVariableAt(), and pushSelf().
Referenced by getBooleanAt(), getFloatAt(), getFunctionAt(), getIntAt(), getRawUserTypeAt(), getStringAt(), and getTableAt().
Variable Aurora::Lua::TableRef::getVariableAt | ( | const Common::UString & | key | ) | const |
Definition at line 370 of file table.cpp.
References _luaState, _metaAccessEnabled, Common::UString::c_str(), Aurora::Lua::Stack::getVariableAt(), and pushSelf().
Variables Aurora::Lua::TableRef::getVariables | ( | ) | const |
Definition at line 438 of file table.cpp.
References _luaState, Aurora::Lua::Stack::getVariableAt(), and pushSelf().
bool Aurora::Lua::TableRef::isBooleanAt | ( | int | index | ) | const |
Definition at line 460 of file table.cpp.
References getTypeAt(), and Aurora::Lua::kTypeBoolean.
Referenced by getBooleanAt().
bool Aurora::Lua::TableRef::isBooleanAt | ( | const Common::UString & | key | ) | const |
Definition at line 464 of file table.cpp.
References getTypeAt(), and Aurora::Lua::kTypeBoolean.
bool Aurora::Lua::TableRef::isFunctionAt | ( | int | index | ) | const |
Definition at line 492 of file table.cpp.
References getTypeAt(), and Aurora::Lua::kTypeFunction.
Referenced by getFunctionAt().
bool Aurora::Lua::TableRef::isFunctionAt | ( | const Common::UString & | key | ) | const |
Definition at line 496 of file table.cpp.
References getTypeAt(), and Aurora::Lua::kTypeFunction.
bool Aurora::Lua::TableRef::isMetaAccessEnabled | ( | ) | const |
Definition at line 130 of file table.cpp.
References _metaAccessEnabled.
bool Aurora::Lua::TableRef::isNilAt | ( | int | index | ) | const |
Definition at line 452 of file table.cpp.
References getTypeAt(), and Aurora::Lua::kTypeNil.
bool Aurora::Lua::TableRef::isNilAt | ( | const Common::UString & | key | ) | const |
Definition at line 456 of file table.cpp.
References getTypeAt(), and Aurora::Lua::kTypeNil.
bool Aurora::Lua::TableRef::isNumberAt | ( | int | index | ) | const |
Definition at line 468 of file table.cpp.
References getTypeAt(), and Aurora::Lua::kTypeNumber.
Referenced by getFloatAt(), and getIntAt().
bool Aurora::Lua::TableRef::isNumberAt | ( | const Common::UString & | key | ) | const |
Definition at line 472 of file table.cpp.
References getTypeAt(), and Aurora::Lua::kTypeNumber.
bool Aurora::Lua::TableRef::isStringAt | ( | int | index | ) | const |
Definition at line 476 of file table.cpp.
References getTypeAt(), and Aurora::Lua::kTypeString.
Referenced by getStringAt().
bool Aurora::Lua::TableRef::isStringAt | ( | const Common::UString & | key | ) | const |
Definition at line 480 of file table.cpp.
References getTypeAt(), and Aurora::Lua::kTypeString.
bool Aurora::Lua::TableRef::isTableAt | ( | int | index | ) | const |
Definition at line 484 of file table.cpp.
References getTypeAt(), and Aurora::Lua::kTypeTable.
Referenced by getTableAt().
bool Aurora::Lua::TableRef::isTableAt | ( | const Common::UString & | key | ) | const |
Definition at line 488 of file table.cpp.
References getTypeAt(), and Aurora::Lua::kTypeTable.
bool Aurora::Lua::TableRef::isUserTypeAt | ( | int | index, |
const Common::UString & | type = "" |
||
) | const |
Check whether the value at the given index is a usertype value.
If type is not empty, perform a type check.
Definition at line 500 of file table.cpp.
References Common::UString::empty(), getExactTypeAt(), getTypeAt(), and Aurora::Lua::kTypeUserType.
Referenced by Aurora::Lua::getRawCppObjectFromStack(), Aurora::Lua::getRawCppObjectFromVariable(), and getRawUserTypeAt().
bool Aurora::Lua::TableRef::isUserTypeAt | ( | const Common::UString & | key, |
const Common::UString & | type = "" |
||
) | const |
Definition at line 508 of file table.cpp.
References Common::UString::empty(), getExactTypeAt(), getTypeAt(), and Aurora::Lua::kTypeUserType.
Definition at line 73 of file table.cpp.
References _luaState, _metaAccessEnabled, and _ref.
|
private |
Definition at line 526 of file table.cpp.
References _luaState, and _ref.
Referenced by getExactType(), getExactTypeAt(), getMetaTable(), getSize(), getTypeAt(), getVariableAt(), getVariables(), removeAt(), and setVariableAt().
void Aurora::Lua::TableRef::removeAt | ( | int | index | ) |
Definition at line 134 of file table.cpp.
References _luaState, and pushSelf().
void Aurora::Lua::TableRef::removeAt | ( | const Common::UString & | key | ) |
Definition at line 143 of file table.cpp.
References _luaState, _metaAccessEnabled, Common::UString::c_str(), and pushSelf().
void Aurora::Lua::TableRef::setBooleanAt | ( | int | index, |
bool | value | ||
) |
Definition at line 158 of file table.cpp.
References setVariableAt().
void Aurora::Lua::TableRef::setBooleanAt | ( | const Common::UString & | key, |
bool | value | ||
) |
Definition at line 162 of file table.cpp.
References setVariableAt().
void Aurora::Lua::TableRef::setFloatAt | ( | int | index, |
float | value | ||
) |
Definition at line 166 of file table.cpp.
References setVariableAt().
void Aurora::Lua::TableRef::setFloatAt | ( | const Common::UString & | key, |
float | value | ||
) |
Definition at line 170 of file table.cpp.
References setVariableAt().
void Aurora::Lua::TableRef::setFunctionAt | ( | int | index, |
const FunctionRef & | value | ||
) |
Definition at line 206 of file table.cpp.
References setVariableAt().
Referenced by Aurora::Lua::ScriptManager::injectNewIndexMetaEventIntoTable().
void Aurora::Lua::TableRef::setFunctionAt | ( | const Common::UString & | key, |
const FunctionRef & | value | ||
) |
Definition at line 210 of file table.cpp.
References setVariableAt().
void Aurora::Lua::TableRef::setIntAt | ( | int | index, |
int | value | ||
) |
Definition at line 174 of file table.cpp.
References setVariableAt().
void Aurora::Lua::TableRef::setIntAt | ( | const Common::UString & | key, |
int | value | ||
) |
Definition at line 178 of file table.cpp.
References setVariableAt().
void Aurora::Lua::TableRef::setMetaAccessEnabled | ( | bool | enabled | ) |
Enable/Disable access to the table elements using metamethods.
Definition at line 126 of file table.cpp.
References _metaAccessEnabled.
Referenced by Aurora::Lua::getRawCppObjectFromStack(), and Aurora::Lua::getRawCppObjectFromVariable().
void Aurora::Lua::TableRef::setStringAt | ( | int | index, |
const char * | value | ||
) |
Definition at line 182 of file table.cpp.
References setVariableAt().
void Aurora::Lua::TableRef::setStringAt | ( | const Common::UString & | key, |
const char * | value | ||
) |
Definition at line 186 of file table.cpp.
References setVariableAt().
void Aurora::Lua::TableRef::setStringAt | ( | int | index, |
const Common::UString & | value | ||
) |
Definition at line 190 of file table.cpp.
References setVariableAt().
void Aurora::Lua::TableRef::setStringAt | ( | const Common::UString & | key, |
const Common::UString & | value | ||
) |
Definition at line 194 of file table.cpp.
References setVariableAt().
void Aurora::Lua::TableRef::setTableAt | ( | int | index, |
const TableRef & | value | ||
) |
Definition at line 198 of file table.cpp.
References setVariableAt().
void Aurora::Lua::TableRef::setTableAt | ( | const Common::UString & | key, |
const TableRef & | value | ||
) |
Definition at line 202 of file table.cpp.
References setVariableAt().
void Aurora::Lua::TableRef::setUserTypeAt | ( | int | index, |
void * | value, | ||
const Common::UString & | type | ||
) |
Push a usertype value onto the stack.
Expect that type is a name of the registered type in the script subsystem.
Definition at line 214 of file table.cpp.
References setVariableAt().
void Aurora::Lua::TableRef::setUserTypeAt | ( | const Common::UString & | key, |
void * | value, | ||
const Common::UString & | type | ||
) |
Definition at line 218 of file table.cpp.
References setVariableAt().
void Aurora::Lua::TableRef::setVariableAt | ( | int | index, |
const Variable & | value | ||
) |
Definition at line 222 of file table.cpp.
References _luaState, pushSelf(), and Aurora::Lua::Stack::pushVariable().
Referenced by setBooleanAt(), setFloatAt(), setFunctionAt(), setIntAt(), setStringAt(), setTableAt(), and setUserTypeAt().
void Aurora::Lua::TableRef::setVariableAt | ( | const Common::UString & | key, |
const Variable & | value | ||
) |
Definition at line 232 of file table.cpp.
References _luaState, _metaAccessEnabled, Common::UString::c_str(), and pushSelf().
|
private |
The Lua state.
Definition at line 144 of file table.h.
Referenced by getExactType(), getExactTypeAt(), getLuaState(), getMetaTable(), getSize(), getTypeAt(), getVariableAt(), getVariables(), operator=(), pushSelf(), removeAt(), setVariableAt(), TableRef(), and ~TableRef().
|
private |
Definition at line 146 of file table.h.
Referenced by getExactTypeAt(), getTypeAt(), getVariableAt(), isMetaAccessEnabled(), operator=(), removeAt(), setMetaAccessEnabled(), and setVariableAt().
|
private |
Definition at line 145 of file table.h.
Referenced by getRef(), operator=(), pushSelf(), TableRef(), and ~TableRef().