struct IScriptTable { struct Iterator { const char * sKey; int nKey; ScriptAnyValue value; ScriptAnyValue key; struct { bool resolvePrototypeTableAsWell; int nStackMarker1; int nStackMarker2; } internal; }; struct SUserFunctionDesc { const char * sFunctionName; const char * sFunctionParams; const char * sGlobalName; FunctionFunctor pFunctor; int nParamIdOffset; UserDataFunction pUserDataFunc; void * pDataBuffer; int nDataSize; }; };
IScriptSystem.h
Iteration over table parameters.
struct Iterator { const char * sKey; int nKey; ScriptAnyValue value; ScriptAnyValue key; struct { bool resolvePrototypeTableAsWell; int nStackMarker1; int nStackMarker2; } internal; };
IScriptSystem.h
Members |
Description |
const char * sKey; |
those 2 are now redundant |
int nStackMarker1; |
used for traversing our own table (this is typically the table that overrides properties from prototype tables) |
int nStackMarker2; |
used after our own table is traversed; we then try to traverse the prototype table (gets retrieved via a potential metatable) |
Structure that describe user data function.
struct SUserFunctionDesc { const char * sFunctionName; const char * sFunctionParams; const char * sGlobalName; FunctionFunctor pFunctor; int nParamIdOffset; UserDataFunction pUserDataFunc; void * pDataBuffer; int nDataSize; };
IScriptSystem.h
int nDataSize;
Size of data associated with user data function.
int nParamIdOffset;
Offset of the parameter to accept as 1st function argument. Pointer to function with associated data buffer.
void * pDataBuffer;
Pointer to the data buffer associated to the user data function.
FunctionFunctor pFunctor;
Pointer to simple function.
UserDataFunction pUserDataFunc;
const char * sFunctionName;
Name of function.
const char * sFunctionParams;
List of parameters (ex "nSlot,vDirection" ).
const char * sGlobalName;
Name of global table (ex "System")
SUserFunctionDesc();
Constructor that initialize all data members to initial state.
virtual ~IScriptTable();
Adds a C++ callback function to the table. Notes: The function is a standard function that returns number of arguments and accept IFunctionHandler as argument.
virtual bool AddFunction(const SUserFunctionDesc & fd) = 0;
Increments reference count to the script table.
virtual void AddRef() = 0;
virtual IScriptTable::Iterator BeginIteration(bool resolvePrototypeTableAsWell = false) = 0;
virtual bool BeginSetGetChain() = 0;
Clears the table,removes all the entries in the table.
virtual void Clear() = 0;
virtual bool Clone(IScriptTable * pSrcTable, bool bDeepCopy = false, bool bCopyByReference = false) = 0;
Parameters |
Description |
IScriptTable * pSrcTable |
Source table to clone from. |
bool bDeepCopy = false |
Defines if source table is cloned recursively or not, if bDeepCopy is false Only does shallow copy (no deep copy, table entries are not cloned hierarchically). If bDeepCopy is true, all sub tables are also cloned recursively. If bDeepCopy is true and bCopyByReference is true, the table structure is copied but the tables are left empty and the metatable is set to point at the original table. |
Produces a copy of the src table.
Gets the count of elements into the object.
virtual int Count() = 0;
virtual void Delegate(IScriptTable * pObj) = 0;
virtual void Dump(IScriptTableDumpSink * p) = 0;
Dumps all table entries to the IScriptTableDumpSink interface.
virtual void EndIteration(const Iterator & iter) = 0;
virtual void EndSetGetChain() = 0;
template <class T> bool GetAt(int nIndex, T & value);
Gets the value of a member variable at the specified index.
virtual bool GetAtAny(int nIndex, ScriptAnyValue & any) = 0;
Gets the value of a member variable at the specified index.
virtual ScriptVarType GetAtType(int nIdx) = 0;
Gets script system of this table.
virtual IScriptSystem* GetScriptSystem() const = 0;
virtual void * GetUserDataValue() = 0;
Gets value of a table member.
template <class T> bool GetValue(const char * sKey, T & value);
Gets the value of a table member.
virtual bool GetValueAny(const char * sKey, ScriptAnyValue & any, bool bChain = false) = 0;
Gets value of a table member.
template <class T> bool GetValueChain(const char * sKey, T & value);
Gets the value type of a table member.
virtual ScriptVarType GetValueType(const char * sKey) = 0;
Parameters |
Description |
const char * sKey |
Variable name. |
The value type or svtNull if doesn't exist.
svtNull
bool HaveAt(int elem);
bool HaveValue(const char * sKey);
virtual bool MoveNext(Iterator & iter) = 0;
template <class T> void PushBack(const T & value);
Adds value at next available index.
Decrements reference count for script table. Notes: When reference count reaches zero, table will be deleted.
virtual void Release() = 0;
template <class T> void SetAt(int nIndex, const T & value);
Sets the value of a member variable at the specified index.
virtual void SetAtAny(int nIndex, const ScriptAnyValue & any) = 0;
Sets the value of a member variable at the specified index this means that you will use the object as vector into the script.
void SetNullAt(int nIndex);
Sets the value of a member variable to nil at the specified index.
Sets member value to nil.
void SetToNull(const char * sKey);
void SetToNullChain(const char * sKey);
Sets value of a table member.
template <class T> void SetValue(const char * sKey, const T & value);
Sets the value of a table member.
virtual void SetValueAny(const char * sKey, const ScriptAnyValue & any, bool bChain = false) = 0;
Sets value of a table member.
template <class T> void SetValueChain(const char * sKey, const T & value);
typedef Functor1wRet<IFunctionHandler*,int> FunctionFunctor;
typedef int (* UserDataFunction)(IFunctionHandler* pH,void *pBuffer,int nSize);