IScriptTable

C++
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;
  };
};
File

IScriptSystem.h

IScriptTable::Iterator Structure

Iteration over table parameters.

C++
struct Iterator {
  const char * sKey;
  int nKey;
  ScriptAnyValue value;
  ScriptAnyValue key;
  struct {
    bool resolvePrototypeTableAsWell;
    int nStackMarker1;
    int nStackMarker2;
  } internal;
};
File

IScriptSystem.h

Members
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)
IScriptTable::SUserFunctionDesc Structure

Structure that describe user data function.

C++
struct SUserFunctionDesc {
  const char * sFunctionName;
  const char * sFunctionParams;
  const char * sGlobalName;
  FunctionFunctor pFunctor;
  int nParamIdOffset;
  UserDataFunction pUserDataFunc;
  void * pDataBuffer;
  int nDataSize;
};
File

IScriptSystem.h

IScriptTable::SUserFunctionDesc::nDataSize Data Member
C++
int nDataSize;
Description

Size of data associated with user data function.

IScriptTable::SUserFunctionDesc::nParamIdOffset Data Member
C++
int nParamIdOffset;
Description

Offset of the parameter to accept as 1st function argument. Pointer to function with associated data buffer.

IScriptTable::SUserFunctionDesc::pDataBuffer Data Member
C++
void * pDataBuffer;
Description

Pointer to the data buffer associated to the user data function.

IScriptTable::SUserFunctionDesc::pFunctor Data Member
C++
FunctionFunctor pFunctor;
Description

Pointer to simple function.

IScriptTable::SUserFunctionDesc::pUserDataFunc Data Member
C++
UserDataFunction pUserDataFunc;
IScriptTable::SUserFunctionDesc::sFunctionName Data Member
C++
const char * sFunctionName;
Description

Name of function.

IScriptTable::SUserFunctionDesc::sFunctionParams Data Member
C++
const char * sFunctionParams;
Description

List of parameters (ex "nSlot,vDirection" ).

IScriptTable::SUserFunctionDesc::sGlobalName Data Member
C++
const char * sGlobalName;
Description

Name of global table (ex "System")

IScriptTable::SUserFunctionDesc::SUserFunctionDesc Constructor
C++
SUserFunctionDesc();
Description

Constructor that initialize all data members to initial state.

IScriptTable::~IScriptTable Destructor
C++
virtual ~IScriptTable();
IScriptTable::AddFunction Method

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.

C++
virtual bool AddFunction(const SUserFunctionDesc & fd) = 0;
See Also
IScriptTable::AddRef Method

Increments reference count to the script table.

C++
virtual void AddRef() = 0;
IScriptTable::BeginIteration Method
C++
virtual IScriptTable::Iterator BeginIteration(bool resolvePrototypeTableAsWell = false) = 0;
IScriptTable::BeginSetGetChain Method

Sets/Gets Chain. Notes: Is a faster version when doing a big amount of SetValue/GetValue.

C++
virtual bool BeginSetGetChain() = 0;
IScriptTable::Clear Method

Clears the table,removes all the entries in the table.

C++
virtual void Clear() = 0;
IScriptTable::Clone Method
C++
virtual bool Clone(IScriptTable * pSrcTable, bool bDeepCopy = false, bool bCopyByReference = false) = 0;
Parameters
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.
Description

Produces a copy of the src table.

IScriptTable::Count Method

Gets the count of elements into the object.

C++
virtual int Count() = 0;
IScriptTable::Delegate Method
C++
virtual void Delegate(IScriptTable * pObj) = 0;
IScriptTable::Dump Method
C++
virtual void Dump(IScriptTableDumpSink * p) = 0;
Description

Dumps all table entries to the IScriptTableDumpSink interface.

See Also
IScriptTable::EndIteration Method
C++
virtual void EndIteration(const Iterator & iter) = 0;
IScriptTable::EndSetGetChain Method
C++
virtual void EndSetGetChain() = 0;
IScriptTable::GetAt Method
C++
template <class T> bool GetAt(int nIndex, T & value);
Description

Gets the value of a member variable at the specified index.

IScriptTable::GetAtAny Method
C++
virtual bool GetAtAny(int nIndex, ScriptAnyValue & any) = 0;
Description

Gets the value of a member variable at the specified index.

IScriptTable::GetAtType Method
C++
virtual ScriptVarType GetAtType(int nIdx) = 0;
IScriptTable::GetScriptSystem Method

Gets script system of this table.

C++
virtual IScriptSystem* GetScriptSystem() const = 0;
IScriptTable::GetUserDataValue Method
C++
virtual void * GetUserDataValue() = 0;
IScriptTable::GetValue Method

Gets value of a table member.

C++
template <class T> bool GetValue(const char * sKey, T & value);
IScriptTable::GetValueAny Method

Gets the value of a table member.

C++
virtual bool GetValueAny(const char * sKey, ScriptAnyValue & any, bool bChain = false) = 0;
IScriptTable::GetValueChain Method

Gets value of a table member.

C++
template <class T> bool GetValueChain(const char * sKey, T & value);
IScriptTable::GetValueType Method

Gets the value type of a table member.

C++
virtual ScriptVarType GetValueType(const char * sKey) = 0;
Parameters
Parameters
Description
const char * sKey
Variable name.
Returns

The value type or svtNull if doesn't exist.

See Also

svtNull

IScriptTable::HaveAt Method
C++
bool HaveAt(int elem);
IScriptTable::HaveValue Method
C++
bool HaveValue(const char * sKey);
IScriptTable::MoveNext Method
C++
virtual bool MoveNext(Iterator & iter) = 0;
IScriptTable::PushBack Method
C++
template <class T> void PushBack(const T & value);
Description

Adds value at next available index.

IScriptTable::Release Method

Decrements reference count for script table. Notes: When reference count reaches zero, table will be deleted.

C++
virtual void Release() = 0;
IScriptTable::SetAt Method
C++
template <class T> void SetAt(int nIndex, const T & value);
Description

Sets the value of a member variable at the specified index.

IScriptTable::SetAtAny Method
C++
virtual void SetAtAny(int nIndex, const ScriptAnyValue & any) = 0;
Description

Sets the value of a member variable at the specified index this means that you will use the object as vector into the script.

IScriptTable::SetNullAt Method
C++
void SetNullAt(int nIndex);
Description

Sets the value of a member variable to nil at the specified index.

IScriptTable::SetToNull Method

Sets member value to nil.

C++
void SetToNull(const char * sKey);
IScriptTable::SetToNullChain Method
C++
void SetToNullChain(const char * sKey);
IScriptTable::SetValue Method

Sets value of a table member.

C++
template <class T> void SetValue(const char * sKey, const T & value);
IScriptTable::SetValueAny Method

Sets the value of a table member.

C++
virtual void SetValueAny(const char * sKey, const ScriptAnyValue & any, bool bChain = false) = 0;
IScriptTable::SetValueChain Method

Sets value of a table member.

C++
template <class T> void SetValueChain(const char * sKey, const T & value);
IScriptTable::FunctionFunctor Nested Type
C++
typedef Functor1wRet<IFunctionHandler*,int> FunctionFunctor;
IScriptTable::UserDataFunction Nested Type
C++
typedef int (* UserDataFunction)(IFunctionHandler* pH,void *pBuffer,int nSize);