xoreos
0.0.5
|
#include <stack.h>
Public Member Functions | |
Stack (lua_State &state) | |
~Stack () | |
int | getSize () const |
Return the number of elements in the stack. More... | |
void | pushNil () |
Push a nil value onto the stack. More... | |
void | pushBoolean (bool value) |
Push a boolean value onto the stack. More... | |
void | pushFloat (float value) |
Push a float value onto the stack. More... | |
void | pushInt (int value) |
Push an integer value onto the stack. More... | |
void | pushString (const char *value) |
Push a raw C string onto the stack. More... | |
void | pushString (const Common::UString &value) |
Push a string onto the stack. More... | |
void | pushTable (const TableRef &value) |
Push a table onto the stack. More... | |
void | pushFunction (const FunctionRef &value) |
Push a function onto the stack. More... | |
void | pushRawUserType (void *value, const Common::UString &type) |
Push a raw usertype value onto the stack. More... | |
void | pushVariable (const Variable &var) |
void | pushVariables (const Variables &vars) |
template<typename T > | |
void | pushUserType (T &value, const Common::UString &type) |
Push a usertype value onto the stack. More... | |
bool | getBooleanAt (int index) const |
Return a boolean value at the given index in the stack. More... | |
float | getFloatAt (int index) const |
Return a float value at the given index in the stack. More... | |
int | getIntAt (int index) const |
Return an integer value at the given index in the stack. More... | |
Common::UString | getStringAt (int index) const |
Return a string at the given index in the stack. More... | |
TableRef | getTableAt (int index) const |
Return a table at the given index in the stack. More... | |
FunctionRef | getFunctionAt (int index) const |
Return a function at the given index in the stack. More... | |
void * | getRawUserTypeAt (int index, const Common::UString &type="") const |
Return a raw usertype value at the given index in the stack. More... | |
template<typename T > | |
T * | getUserTypeAt (int index, const Common::UString &type="") const |
Return a usertype value at the given index in the stack. More... | |
Variable | getVariableAt (int index) const |
Common::UString | getExactTypeAt (int index) const |
Return the type of the value at the given index in the stack. More... | |
Type | getTypeAt (int index) const |
Variables | getVariables () const |
Variables | getVariablesFromTop (int count) const |
bool | isNilAt (int index) const |
Check whether the value with the given index is a nil. More... | |
bool | isBooleanAt (int index) const |
Check whether the value at the given index is a boolean value. More... | |
bool | isNumberAt (int index) const |
Check whether the value at the given index is a number. More... | |
bool | isStringAt (int index) const |
Check whether the value at the given index is a string. More... | |
bool | isTableAt (int index) const |
Check whether the value at the given index is a table. More... | |
bool | isFunctionAt (int index) const |
Check whether the value at the given index is a function. More... | |
bool | isUserTypeAt (int index, const Common::UString &type="") const |
Check whether the value at the given index is a usertype value. More... | |
void | registerGCForTopObject () |
lua_State & | getLuaState () const |
Return the underlying Lua state. More... | |
Private Member Functions | |
bool | checkIndex (int index) const |
Check whether the given index is valid. More... | |
Private Attributes | |
lua_State & | _luaState |
The Lua state. More... | |
|
private |
Check whether the given index is valid.
Definition at line 305 of file stack.cpp.
References getSize().
Referenced by getExactTypeAt(), getTypeAt(), isBooleanAt(), isFunctionAt(), isNilAt(), isNumberAt(), isStringAt(), isTableAt(), and isUserTypeAt().
bool Aurora::Lua::Stack::getBooleanAt | ( | int | index | ) | const |
Return a boolean value at the given index in the stack.
Definition at line 134 of file stack.cpp.
References _luaState, and isBooleanAt().
Referenced by getVariableAt().
Common::UString Aurora::Lua::Stack::getExactTypeAt | ( | int | index | ) | const |
Return the type of the value at the given index in the stack.
Definition at line 208 of file stack.cpp.
References _luaState, and checkIndex().
Referenced by Aurora::Lua::TableRef::getExactType(), Aurora::Lua::TableRef::getExactTypeAt(), and getVariableAt().
float Aurora::Lua::Stack::getFloatAt | ( | int | index | ) | const |
Return a float value at the given index in the stack.
Definition at line 141 of file stack.cpp.
References _luaState, and isNumberAt().
Referenced by getVariableAt(), and Engines::Witcher::LuaBindings::Vector::luaNewLocal().
FunctionRef Aurora::Lua::Stack::getFunctionAt | ( | int | index | ) | const |
Return a function at the given index in the stack.
Definition at line 169 of file stack.cpp.
References _luaState, and isFunctionAt().
Referenced by getVariableAt().
int Aurora::Lua::Stack::getIntAt | ( | int | index | ) | const |
Return an integer value at the given index in the stack.
Definition at line 148 of file stack.cpp.
References _luaState, and isNumberAt().
lua_State & Aurora::Lua::Stack::getLuaState | ( | ) | const |
Return the underlying Lua state.
Definition at line 301 of file stack.cpp.
References _luaState.
Referenced by Aurora::Lua::FunctionRef::call().
void * Aurora::Lua::Stack::getRawUserTypeAt | ( | int | index, |
const Common::UString & | type = "" |
||
) | const |
Return a raw usertype value at the given index in the stack.
Definition at line 176 of file stack.cpp.
References _luaState, Common::UString::c_str(), and isUserTypeAt().
Referenced by Aurora::Lua::getRawCppObjectFromStack(), getUserTypeAt(), getVariableAt(), Aurora::Lua::ScriptManager::luaRegisterSubst(), and Aurora::Lua::ScriptManager::luaUnregisterSubst().
int Aurora::Lua::Stack::getSize | ( | ) | const |
Return the number of elements in the stack.
Definition at line 48 of file stack.cpp.
References _luaState.
Referenced by Aurora::Lua::FunctionRef::call(), checkIndex(), Aurora::Lua::DefaultDeleter< T >::function(), getVariables(), Engines::Witcher::LuaBindings::Vector::luaGetX(), Engines::Witcher::LuaBindings::Vector::luaGetY(), Engines::Witcher::LuaBindings::Vector::luaGetZ(), Engines::Witcher::LuaBindings::Vector::luaNewLocal(), Aurora::Lua::ScriptManager::luaPlayFile(), Aurora::Lua::ScriptManager::luaRegisterSubst(), Engines::Witcher::LuaBindings::Vector::luaSet(), Engines::Witcher::LuaBindings::Vector::luaSetX(), Engines::Witcher::LuaBindings::Vector::luaSetY(), Engines::Witcher::LuaBindings::Vector::luaSetZ(), Aurora::Lua::ScriptManager::luaUnregisterSubst(), and registerGCForTopObject().
Common::UString Aurora::Lua::Stack::getStringAt | ( | int | index | ) | const |
Return a string at the given index in the stack.
Definition at line 155 of file stack.cpp.
References _luaState, and isStringAt().
Referenced by getVariableAt(), and Aurora::Lua::ScriptManager::luaPlayFile().
TableRef Aurora::Lua::Stack::getTableAt | ( | int | index | ) | const |
Return a table at the given index in the stack.
Definition at line 162 of file stack.cpp.
References _luaState, and isTableAt().
Referenced by Aurora::Lua::TableRef::getMetaTable(), Aurora::Lua::getRawCppObjectFromStack(), getVariableAt(), and Aurora::Lua::ScriptManager::luaRegisterSubst().
Type Aurora::Lua::Stack::getTypeAt | ( | int | index | ) | const |
Definition at line 218 of file stack.cpp.
References _luaState, checkIndex(), Aurora::Lua::kTypeBoolean, Aurora::Lua::kTypeFunction, Aurora::Lua::kTypeNil, Aurora::Lua::kTypeNone, Aurora::Lua::kTypeNumber, Aurora::Lua::kTypeString, Aurora::Lua::kTypeTable, Aurora::Lua::kTypeUserType, and warning().
Referenced by Aurora::Lua::getRawCppObjectFromStack(), Aurora::Lua::TableRef::getTypeAt(), getVariableAt(), isUserTypeAt(), Aurora::Lua::ScriptManager::luaRegisterHandler(), and registerGCForTopObject().
T * Aurora::Lua::Stack::getUserTypeAt | ( | 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 143 of file stack.h.
References getRawUserTypeAt().
Referenced by Aurora::Lua::ScriptManager::luaRegisterSubst(), and Aurora::Lua::ScriptManager::luaUnregisterSubst().
Variable Aurora::Lua::Stack::getVariableAt | ( | int | index | ) | const |
Definition at line 185 of file stack.cpp.
References getBooleanAt(), getExactTypeAt(), getFloatAt(), getFunctionAt(), getRawUserTypeAt(), getStringAt(), getTableAt(), getTypeAt(), Aurora::Lua::kTypeBoolean, Aurora::Lua::kTypeFunction, Aurora::Lua::kTypeNil, Aurora::Lua::kTypeNone, Aurora::Lua::kTypeNumber, Aurora::Lua::kTypeString, Aurora::Lua::kTypeTable, and Aurora::Lua::kTypeUserType.
Referenced by Aurora::Lua::TableRef::getVariableAt(), getVariables(), and Aurora::Lua::TableRef::getVariables().
Variables Aurora::Lua::Stack::getVariables | ( | ) | const |
Definition at line 246 of file stack.cpp.
References getSize(), and getVariableAt().
Aurora::Lua::Variables Aurora::Lua::Stack::getVariablesFromTop | ( | int | count | ) | const |
Definition at line 254 of file stack.cpp.
Referenced by Aurora::Lua::FunctionRef::call().
bool Aurora::Lua::Stack::isBooleanAt | ( | int | index | ) | const |
Check whether the value at the given index is a boolean value.
Definition at line 267 of file stack.cpp.
References _luaState, and checkIndex().
Referenced by getBooleanAt().
bool Aurora::Lua::Stack::isFunctionAt | ( | int | index | ) | const |
Check whether the value at the given index is a function.
Definition at line 283 of file stack.cpp.
References _luaState, and checkIndex().
Referenced by getFunctionAt().
bool Aurora::Lua::Stack::isNilAt | ( | int | index | ) | const |
Check whether the value with the given index is a nil.
Definition at line 263 of file stack.cpp.
References _luaState, and checkIndex().
bool Aurora::Lua::Stack::isNumberAt | ( | int | index | ) | const |
Check whether the value at the given index is a number.
Definition at line 271 of file stack.cpp.
References _luaState, and checkIndex().
Referenced by getFloatAt(), and getIntAt().
bool Aurora::Lua::Stack::isStringAt | ( | int | index | ) | const |
Check whether the value at the given index is a string.
Definition at line 275 of file stack.cpp.
References _luaState, and checkIndex().
Referenced by getStringAt().
bool Aurora::Lua::Stack::isTableAt | ( | int | index | ) | const |
Check whether the value at the given index is a table.
Definition at line 279 of file stack.cpp.
References _luaState, and checkIndex().
Referenced by getTableAt().
bool Aurora::Lua::Stack::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 287 of file stack.cpp.
References _luaState, Common::UString::c_str(), checkIndex(), Common::UString::empty(), error(), getTypeAt(), and Aurora::Lua::kTypeUserType.
Referenced by getRawUserTypeAt().
void Aurora::Lua::Stack::pushBoolean | ( | bool | value | ) |
Push a boolean value onto the stack.
Definition at line 56 of file stack.cpp.
References _luaState.
Referenced by Engines::Witcher::LuaBindings::luaIsDebugBuild(), Engines::Witcher::LuaBindings::luaIsDemo(), Engines::Witcher::LuaBindings::luaIsDjinni(), Engines::Witcher::LuaBindings::luaIsEditor(), Engines::Witcher::LuaBindings::luaValidNumber(), and pushVariable().
void Aurora::Lua::Stack::pushFloat | ( | float | value | ) |
Push a float value onto the stack.
Definition at line 60 of file stack.cpp.
References _luaState.
Referenced by pushVariable().
void Aurora::Lua::Stack::pushFunction | ( | const FunctionRef & | value | ) |
Push a function onto the stack.
Definition at line 85 of file stack.cpp.
References _luaState, and Aurora::Lua::FunctionRef::getRef().
Referenced by pushVariable().
void Aurora::Lua::Stack::pushInt | ( | int | value | ) |
Push an integer value onto the stack.
Definition at line 64 of file stack.cpp.
References _luaState.
Referenced by Engines::Witcher::LuaBindings::luaBor(), Engines::Witcher::LuaBindings::ScreenSizes::luaGetActualGUIWidth(), Engines::Witcher::LuaBindings::CClientExoApp::luaGetClientTextLanguage(), Engines::Witcher::LuaBindings::CAuroraSettings::luaGetDialogHorizontalOffset(), Engines::Witcher::LuaBindings::CGUINewControl::luaGetFlags(), Engines::Witcher::LuaBindings::C2DA::luaGetIntEntry(), and Engines::Witcher::LuaBindings::C2DA::luaGetNumRows().
void Aurora::Lua::Stack::pushNil | ( | ) |
Push a nil value onto the stack.
Definition at line 52 of file stack.cpp.
References _luaState.
Referenced by Engines::Witcher::LuaBindings::C2DA::luaGetCExoStringEntry(), Engines::Witcher::LuaBindings::C2DA::luaGetIntEntry(), and pushVariable().
void Aurora::Lua::Stack::pushRawUserType | ( | void * | value, |
const Common::UString & | type | ||
) |
Push a raw usertype value onto the stack.
Definition at line 94 of file stack.cpp.
References _luaState, and Common::UString::c_str().
Referenced by pushUserType(), and pushVariable().
void Aurora::Lua::Stack::pushString | ( | const char * | value | ) |
Push a raw C string onto the stack.
Definition at line 68 of file stack.cpp.
References _luaState.
Referenced by Engines::Witcher::LuaBindings::C2DA::luaGetCExoStringEntry(), and pushVariable().
void Aurora::Lua::Stack::pushString | ( | const Common::UString & | value | ) |
Push a string onto the stack.
Definition at line 72 of file stack.cpp.
References _luaState, and Common::UString::c_str().
void Aurora::Lua::Stack::pushTable | ( | const TableRef & | value | ) |
Push a table onto the stack.
Definition at line 76 of file stack.cpp.
References _luaState, and Aurora::Lua::TableRef::getRef().
Referenced by pushVariable().
void Aurora::Lua::Stack::pushUserType | ( | T & | 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 138 of file stack.h.
References pushRawUserType().
Referenced by Aurora::Lua::ScriptManager::luaGetLua(), Engines::Witcher::LuaBindings::Vector::luaNewLocal(), and Engines::Witcher::pushFakeObject().
void Aurora::Lua::Stack::pushVariable | ( | const Variable & | var | ) |
Definition at line 98 of file stack.cpp.
References Common::UString::c_str(), Aurora::Lua::Variable::getBool(), Aurora::Lua::Variable::getExactType(), Aurora::Lua::Variable::getFloat(), Aurora::Lua::Variable::getFunction(), Aurora::Lua::Variable::getRawUserType(), Aurora::Lua::Variable::getString(), Aurora::Lua::Variable::getTable(), Aurora::Lua::Variable::getType(), Aurora::Lua::kTypeBoolean, Aurora::Lua::kTypeFunction, Aurora::Lua::kTypeNil, Aurora::Lua::kTypeNumber, Aurora::Lua::kTypeString, Aurora::Lua::kTypeTable, Aurora::Lua::kTypeUserType, pushBoolean(), pushFloat(), pushFunction(), pushNil(), pushRawUserType(), pushString(), pushTable(), and warning().
Referenced by pushVariables(), and Aurora::Lua::TableRef::setVariableAt().
void Aurora::Lua::Stack::pushVariables | ( | const Variables & | vars | ) |
Definition at line 128 of file stack.cpp.
References pushVariable().
Referenced by Aurora::Lua::FunctionRef::call().
void Aurora::Lua::Stack::registerGCForTopObject | ( | ) |
Definition at line 296 of file stack.cpp.
References _luaState, getSize(), getTypeAt(), and Aurora::Lua::kTypeUserType.
Referenced by Engines::Witcher::LuaBindings::Vector::luaNewLocal().
|
private |
The Lua state.
Definition at line 131 of file stack.h.
Referenced by getBooleanAt(), getExactTypeAt(), getFloatAt(), getFunctionAt(), getIntAt(), getLuaState(), getRawUserTypeAt(), getSize(), getStringAt(), getTableAt(), getTypeAt(), isBooleanAt(), isFunctionAt(), isNilAt(), isNumberAt(), isStringAt(), isTableAt(), isUserTypeAt(), pushBoolean(), pushFloat(), pushFunction(), pushInt(), pushNil(), pushRawUserType(), pushString(), pushTable(), and registerGCForTopObject().