72 template <
typename RT>
89 virtual bool hasField(
const std::string& name,
bool resolveDots =
true);
110 std::vector<std::string>
keys();
116 template <
typename T>
117 void setField(
const std::string& name,
const T& val);
123 template <
typename T>
124 void setField(
int index,
const T& val);
170template <
typename RT>
175 throw "Cannot set a field on a non-valid table";
181 return state.get<RT>(-1);
189 throw "Cannot set a field on a non-valid table";
194 LOG_FATAL(
"Lua") <<
"Cannot set field in non-table type" << std::endl;
213 localState.
push(name);
214 localState.
push(val);
225 LOG_WARN(
"Lua") <<
"Cannot set a field on a non-valid table" << std::endl;
231 LOG_WARN(
"Lua") <<
"Cannot set field in non-table type" << std::endl;
250 localState.
push(index);
251 localState.
push(val);
DtLuaObject & operator=(const DtLuaObject &orig)
Assignment operator.
virtual DtLuaObject operator[](int index)
Gets a field by numeric index.
virtual lua_State * state()
Gets the Lua state associated with this object.
DtLuaObject(lua_State &state, int index)
Constructor from Lua stack value.
DtLuaReference * myReference
Reference to the Lua object.
Definition luaObject.h:160
void setField(const std::string &name, const T &val)
Sets a field value by name.
Definition luaObject.h:185
virtual void push() const
Pushes this object onto the Lua stack.
virtual bool isValid() const
Checks if this object is valid.
virtual void setTable(int index)
Sets a table field with values already on the Lua stack.
virtual std::string serialize()
Serializes the object to a string representation.
virtual bool hasField(const std::string &name, bool resolveDots=true)
Checks if the table has a field with the given name.
virtual bool getItemOnStack(int index)
Retrieves an indexed item from the table and pushes it onto the stack.
virtual ~DtLuaObject() override
Virtual destructor.
virtual bool getItemOnStack(const std::string &name, bool resolveDots)
Retrieves a named item from the table and pushes it onto the stack.
DtLuaObject()
Default constructor.
std::vector< std::string > keys()
Gets all string keys in the table.
virtual bool hasField(int index)
Checks if the table has a field at the given numeric index.
RT get()
Gets the value of this object converted to a C++ type.
Definition luaObject.h:171
virtual int tableSize()
Gets the number of elements in the table.
virtual DtLuaObject operator[](std::string name)
Gets a field by name.
lua_State * myState
Pointer to the Lua state.
Definition luaObject.h:163
DtLuaObject(const DtLuaObject &orig)
Copy constructor.
virtual bool operator==(const DtLuaObject &rhs)
Equality comparison operator.
Manages references to Lua objects through the Lua registry.
Definition luaReference.h:28
A utility class for automatically cleaning the Lua stack.
Definition luaStackCleaner.h:28
Class for managing a Lua state and providing high-level operations.
Definition luaState.h:43
void push(const T &data)
Pushes a C++ value onto the Lua stack.
Definition luaState.h:236
@ SCRIPT_TABLE
Table reference.
Definition luaValue.h:45
DtLuaValue()
Default constructor.
ScriptDataTypeEnum myType
The type of the stored value.
Definition luaValue.h:187
Defines export macros for the VREngage Utility library.
#define UTIL_DLL
Export/import macro for non-Windows platforms.
Definition export.h:39
Provides logging functionality with various severity levels and channels.
#define LOG_WARN(channel)
Macro to log a warning message to log files.
Definition logger.h:69
#define LOG_FATAL(channel)
Macro to log a fatal message to log files.
Definition logger.h:64
Provides a RAII mechanism for automatically cleaning the Lua stack.
Provides an interface for interacting with a Lua state in VREngage.
Provides a C++ wrapper for Lua values.
Include export definitions for this library.
Definition glsVreMessageUtil.h:49