|
VR-Engage
2.2
|
This class provides table-based access to a Lua state, allowing for retrieval of configuration values from Lua tables. It is primarily used by DtInitializer to access the global '_G' table and other configuration tables.
#include <initializer.h>
Public Member Functions | |
| DtInitTable () | |
| DtInitTable (lua_State &state, int index, bool throwOnMissingField=true) | |
| virtual | ~DtInitTable () override |
| template<typename RT> | |
| RT | findData (const std::string &name, bool resolveDots=true) |
| template<typename RT> | |
| RT | findDataOr (const std::string &name, RT defaultValue, bool silent=false, bool resolveDots=true) |
| template<typename RT> | |
| RT | findData (int index) |
| virtual void | setThrowOnMissingField (bool set) |
Public Member Functions inherited from makVre::DtLuaObject | |
| DtLuaObject () | |
| DtLuaObject (lua_State &state, int index) | |
| virtual | ~DtLuaObject () override |
| DtLuaObject (const DtLuaObject &orig) | |
| DtLuaObject & | operator= (const DtLuaObject &orig) |
| virtual bool | operator== (const DtLuaObject &rhs) |
| template<typename RT> | |
| RT | get () |
| virtual void | push () const |
| virtual lua_State * | state () |
| virtual std::string | serialize () |
| virtual bool | isValid () const |
| virtual bool | hasField (const std::string &name, bool resolveDots=true) |
| virtual bool | hasField (int index) |
| virtual DtLuaObject | operator[] (std::string name) |
| virtual DtLuaObject | operator[] (int index) |
| virtual int | tableSize () |
| std::vector< std::string > | keys () |
| template<typename T> | |
| void | setField (const std::string &name, const T &val) |
| template<typename T> | |
| void | setField (int index, const T &val) |
Public Member Functions inherited from makVre::DtLuaValue | |
| virtual ScriptDataTypeEnum | type () const |
| virtual std::string | typeName () const |
| DtLuaValue () | |
| DtLuaValue (bool v) | |
| DtLuaValue (int v) | |
| DtLuaValue (float v) | |
| DtLuaValue (double v) | |
| DtLuaValue (const std::string &v) | |
| DtLuaValue (const char *v) | |
| DtLuaValue (void *v) | |
| virtual | ~DtLuaValue () |
| DtLuaValue (const DtLuaValue &orig) | |
| DtLuaValue & | operator= (const DtLuaValue &orig) |
| virtual bool | isNil () const |
| virtual bool | isBool () const |
| virtual bool | isInt () const |
| virtual bool | isFloat () const |
| virtual bool | isDouble () const |
| virtual bool | isString () const |
| virtual bool | isPointer () const |
| virtual bool | isTable () const |
| virtual bool | isFunction () const |
| virtual bool | boolValue () const |
| virtual int | intValue () const |
| virtual float | floatValue () const |
| virtual double | doubleValue () const |
| virtual std::string | stringValue () const |
| virtual void * | pointerValue () const |
Protected Attributes | ||
| bool | myThrowOnMissingField | |
Protected Attributes inherited from makVre::DtLuaObject | ||
| DtLuaReference * | myReference | |
| lua_State * | myState | |
Protected Attributes inherited from makVre::DtLuaValue | ||
| ScriptDataTypeEnum | myType | |
| union { | ||
| bool myBool | ||
| int myInt | ||
| float myFloat | ||
| double myDouble | ||
| const char * myString | ||
| void * myPtr | ||
| }; | ||
Additional Inherited Members | |
Public Types inherited from makVre::DtLuaValue | |
| enum | ScriptDataTypeEnum { SCRIPT_NIL , SCRIPT_BOOL , SCRIPT_INT , SCRIPT_FLOAT , SCRIPT_DOUBLE , SCRIPT_STRING , SCRIPT_POINTER , SCRIPT_FUNCTION , SCRIPT_TABLE } |
Protected Member Functions inherited from makVre::DtLuaObject | |
| virtual bool | getItemOnStack (const std::string &name, bool resolveDots) |
| virtual bool | getItemOnStack (int index) |
| virtual void | setTable (int index) |
| makVre::DtInitTable::DtInitTable | ( | ) |
Default constructor.
Creates an empty initialization table
| makVre::DtInitTable::DtInitTable | ( | lua_State & | state, |
| int | index, | ||
| bool | throwOnMissingField = true ) |
Constructor with existing Lua state and table.
| state | Reference to the Lua state containing the table |
| index | Index of the table on the Lua stack |
| throwOnMissingField | If true, throws an exception when a requested field is not found |
References makVre::DtLuaObject::state().
|
overridevirtual |
Destructor.
References findData(), and findDataOr().
| RT makVre::DtInitTable::findData | ( | const std::string & | name, |
| bool | resolveDots = true ) |
| RT makVre::DtInitTable::findDataOr | ( | const std::string & | name, |
| RT | defaultValue, | ||
| bool | silent = false, | ||
| bool | resolveDots = true ) |
References findData(), makVre::DtLuaObject::hasField(), and LOG_VERBOSE.
Referenced by ~DtInitTable().
| RT makVre::DtInitTable::findData | ( | int | index | ) |
|
virtual |
Sets whether to throw exceptions for missing fields.
| set | If true, missing fields will cause exceptions; if false, will return default values |
|
protected |
Controls exception behavior for missing fields.
When true, missing fields will cause exceptions to be thrown
Referenced by findData(), and findData().