25 #include "toluapp/tolua++.h" 41 _ref(LUA_REFNIL), _metaAccessEnabled(true) {
45 _ref(LUA_REFNIL), _metaAccessEnabled(true) {
52 _ref(LUA_REFNIL), _metaAccessEnabled(true) {
59 _ref(LUA_REFNIL), _metaAccessEnabled(table._metaAccessEnabled) {
81 const int oldRef =
_ref;
88 if (oldState && oldRef != LUA_REFNIL) {
89 lua_unref(oldState, oldRef);
239 stack.pushVariable(value);
250 throw Common::Exception(
"Failed get a boolean value from the table (index: %d)", index);
266 throw Common::Exception(
"Failed get a float value from the table (index: %d)", index);
282 throw Common::Exception(
"Failed get an integer value from the table (index: %d)", index);
298 throw Common::Exception(
"Failed get a string value from the table (index: %d)", index);
314 throw Common::Exception(
"Failed get a table value from the table (index: %d)", index);
330 throw Common::Exception(
"Failed get a function value from the table (index: %d)", index);
346 throw Common::Exception(
"Failed get a usertype value from the table (index: %d)", index);
void * getRawUserType() const
bool getBooleanAt(int index) const
TableRef getTableAt(int index) const
Return a table at the given index in the stack.
void setStringAt(int index, const char *value)
A class holding an UTF-8 string.
TableRef getTableAt(int index) const
A reference to a Lua function.
float getFloatAt(int index) const
Variable getVariableAt(int index) const
const FunctionRef & getFunction() const
Common::UString getExactTypeAt(int index) const
Return the type of the value at the given index in the stack.
bool isUserTypeAt(int index, const Common::UString &type="") const
Check whether the value at the given index is a usertype value.
void setVariableAt(int index, const Variable &value)
Common::UString getExactType() const
const TableRef & operator=(const TableRef &table)
void setUserTypeAt(int index, void *value, const Common::UString &type)
Push a usertype value onto the stack.
FunctionRef getFunctionAt(int index) const
Basic exceptions to throw.
const char * c_str() const
Return the (utf8 encoded) string data.
TableRef getMetaTable() const
bool isNumberAt(int index) const
Utility templates and functions.
void setFloatAt(int index, float value)
Common::UString & getString()
void setBooleanAt(int index, bool value)
Type getTypeAt(int index) const
bool isNilAt(int index) const
bool empty() const
Is the string empty?
int getSize() const
Return the number of elements in the table.
std::vector< Variable > Variables
void setTableAt(int index, const TableRef &value)
void setFunctionAt(int index, const FunctionRef &value)
A reference to a Lua function.
bool isFunctionAt(int index) const
Variables getVariables() const
bool isMetaAccessEnabled() const
void setIntAt(int index, int value)
Common::UString getStringAt(int index) const
int getIntAt(int index) const
bool isTableAt(int index) const
lua_State & getLuaState() const
Return the underlying Lua state.
void * getRawUserTypeAt(int index, const Common::UString &type="") const
Return a usertype value at the given index in the stack.
A reference to a Lua table.
A reference to a Lua table.
Common::UString getExactTypeAt(int index) const
void pushVariable(const Variable &var)
lua_State * _luaState
The Lua state.
bool isStringAt(int index) const
bool isBooleanAt(int index) const
Type getTypeAt(int index) const
void setMetaAccessEnabled(bool enabled)
Enable/Disable access to the table elements using metamethods.
Variable getVariableAt(int index) const