|  | overview |  | wiki |  | api reference |  | download

- Main Page
- Classes

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Functions Variables Typedefs Enumerations Enumerator
Classes | Static Public Member Functions
gameplay::ScriptUtil Class Reference

`#include <ScriptController.h>`

List of all members.

## Classes

class | LuaArray
struct | LuaObject

## Static Public Member Functions

static void | registerLibrary (const char *name, const luaL_Reg *functions)
static void | registerConstantBool (const std::string &name, bool value, const std::vector< std::string > &scopePath)
static void | registerConstantNumber (const std::string &name, double value, const std::vector< std::string > &scopePath)
static void | registerConstantString (const std::string &name, const std::string &value, const std::vector< std::string > &scopePath)
static void | registerEnumValue (int enumValue, const std::string &enumValueString, const std::vector< std::string > &scopePath)
static void | registerClass (const char *name, const luaL_Reg *members, lua_CFunction newFunction, lua_CFunction deleteFunction, const luaL_Reg *statics, const std::vector< std::string > &scopePath)
static void | registerFunction (const char *luaFunction, lua_CFunction cppFunction)
static void | setGlobalHierarchyPair (const std::string &base, const std::string &derived)
static LuaArray< bool > | getBoolPointer (int index)
static LuaArray< short > | getShortPointer (int index)
static LuaArray< int > | getIntPointer (int index)
static LuaArray< long > | getLongPointer (int index)
static LuaArray< unsigned char > | getUnsignedCharPointer (int index)
static LuaArray< unsigned short > | getUnsignedShortPointer (int index)
static LuaArray< unsigned int > | getUnsignedIntPointer (int index)
static LuaArray< unsigned long > | getUnsignedLongPointer (int index)
static LuaArray< float > | getFloatPointer (int index)
static LuaArray< double > | getDoublePointer (int index)
template<typename T >
static LuaArray< T > | getObjectPointer (int index, const char *type, bool nonNull, bool *success)
static const char * | getString (int index, bool isStdString)
static bool | luaCheckBool (lua_State *state, int n)

## Detailed Description

Functions and structures used by the generated Lua script bindings.

This class is used internally by the generated script bindings and is not intended to be used directly.

## Member Function Documentation

static LuaArray<bool> gameplay::ScriptUtil::getBoolPointer | ( | int | index | ) | `[static]`

Gets a pointer to a bool (as an array-use SAFE_DELETE_ARRAY to clean up) for the given stack index.

Parameters:

  index | The stack index.

Returns:
  The pointer.

static LuaArray<double> gameplay::ScriptUtil::getDoublePointer | ( | int | index | ) | `[static]`

Gets a pointer to a double (as an array-use SAFE_DELETE_ARRAY to clean up) for the given stack index.

Parameters:

  index | The stack index.

Returns:
  The pointer.

static LuaArray<float> gameplay::ScriptUtil::getFloatPointer | ( | int | index | ) | `[static]`

Gets a pointer to a float (as an array-use SAFE_DELETE_ARRAY to clean up) for the given stack index.

Parameters:

  index | The stack index.

Returns:
  The pointer.

static LuaArray<int> gameplay::ScriptUtil::getIntPointer | ( | int | index | ) | `[static]`

Gets a pointer to an int (as an array-use SAFE_DELETE_ARRAY to clean up) for the given stack index.

Parameters:

  index | The stack index.

Returns:
  The pointer.

static LuaArray<long> gameplay::ScriptUtil::getLongPointer | ( | int | index | ) | `[static]`

Gets a pointer to a long (as an array-use SAFE_DELETE_ARRAY to clean up) for the given stack index.

Parameters:

  index | The stack index.

Returns:
  The pointer.

template<typename T >

static LuaArray<T> gameplay::ScriptUtil::getObjectPointer | ( | int | index,
|  | const char * | type,
|  | bool | nonNull,
|  | bool * | success
| ) |  | `[static]`

Gets an object pointer of the given type for the given stack index.

Parameters:

  type | The type of object pointer to retrieve.
  index | The stack index.
  nonNull | Whether the pointer must be non-null (e.g. if the parameter we are retrieving is actually a reference or by-value parameter).
  success | An out parameter that is set to true if the Lua parameter was successfully converted to a valid object, or false if it was unable to perform a valid conversion.

Returns:
  The object pointer or `NULL` if the data at the stack index is not an object or if the object is not derived from the given type.

static LuaArray<short> gameplay::ScriptUtil::getShortPointer | ( | int | index | ) | `[static]`

Gets a pointer to a short (as an array-use SAFE_DELETE_ARRAY to clean up) for the given stack index.

Parameters:

  index | The stack index.

Returns:
  The pointer.

static const char* gameplay::ScriptUtil::getString | ( | int | index,
|  | bool | isStdString
| ) |  | `[static]`

Gets a string for the given stack index.

Parameters:

  index | The stack index.
  isStdString | Whether the string being retrieved is a std::string object or not.

Returns:
  The string or `NULL`.

static LuaArray<unsigned char> gameplay::ScriptUtil::getUnsignedCharPointer | ( | int | index | ) | `[static]`

Gets a pointer to an unsigned char (as an array-use SAFE_DELETE_ARRAY to clean up) for the given stack index.

Parameters:

  index | The stack index.

Returns:
  The pointer.

static LuaArray<unsigned int> gameplay::ScriptUtil::getUnsignedIntPointer | ( | int | index | ) | `[static]`

Gets a pointer to an unsigned int (as an array-use SAFE_DELETE_ARRAY to clean up) for the given stack index.

Parameters:

  index | The stack index.

Returns:
  The pointer.

static LuaArray<unsigned long> gameplay::ScriptUtil::getUnsignedLongPointer | ( | int | index | ) | `[static]`

Gets a pointer to an unsigned long (as an array-use SAFE_DELETE_ARRAY to clean up) for the given stack index.

Parameters:

  index | The stack index.

Returns:
  The pointer.

static LuaArray<unsigned short> gameplay::ScriptUtil::getUnsignedShortPointer | ( | int | index | ) | `[static]`

Gets a pointer to an unsigned short (as an array-use SAFE_DELETE_ARRAY to clean up) for the given stack index.

Parameters:

  index | The stack index.

Returns:
  The pointer.

static bool gameplay::ScriptUtil::luaCheckBool | ( | lua_State * | state,
|  | int | n
| ) |  | `[static]`

Checks that the parameter at the given stack position is a boolean and returns it.

Parameters:

  state | The Lua state.
  n | The stack index.

Returns:
  The boolean (if successful; otherwise it logs an error).

static void gameplay::ScriptUtil::registerClass | ( | const char * | name,
|  | const luaL_Reg * | members,
|  | lua_CFunction | newFunction,
|  | lua_CFunction | deleteFunction,
|  | const luaL_Reg * | statics,
|  | const std::vector< std::string > & | scopePath
| ) |  | `[static]`

Registers the given class type with Lua.

Parameters:

  name | The name of the class from within Lua.
  members | The library function mapping for all the member functions (Lua function names to C++ functions).
  newFunction | The function to call that creates an instance of the class.
  deleteFunction | The function to call that destroys an instance of the class.
  statics | The library function mapping for all the static functions (Lua function names to C++ functions).
  scopePath | For an inner class, this is a list of its containing classes, going inward from the most outer class.

static void gameplay::ScriptUtil::registerConstantBool | ( | const std::string & | name,
|  | bool | value,
|  | const std::vector< std::string > & | scopePath
| ) |  | `[static]`

Registers the given boolean constant as valid for the given scope path.

Parameters:

  name | The name of the constant (what the user would use from Lua).
  value | The constant's value.
  scopePath | The list of containing classes, going inward from the most outer class.

static void gameplay::ScriptUtil::registerConstantNumber | ( | const std::string & | name,
|  | double | value,
|  | const std::vector< std::string > & | scopePath
| ) |  | `[static]`

Registers the given number constant as valid for the given scope path.

Parameters:

  name | The name of the constant (what the user would use from Lua).
  value | The constant's value.
  scopePath | The list of containing classes, going inward from the most outer class.

static void gameplay::ScriptUtil::registerConstantString | ( | const std::string & | name,
|  | const std::string & | value,
|  | const std::vector< std::string > & | scopePath
| ) |  | `[static]`

Registers the given string constant as valid for the given scope path.

Parameters:

  name | The name of the constant (what the user would use from Lua).
  value | The constant's value.
  scopePath | The list of containing classes, going inward from the most outer class.

static void gameplay::ScriptUtil::registerEnumValue | ( | int | enumValue,
|  | const std::string & | enumValueString,
|  | const std::vector< std::string > & | scopePath
| ) |  | `[static]`

Registers the given enum value as valid for the given scope path.

Parameters:

  enumValue | The enumeration value, expressed as an integer.
  enumValueString | The string representation of the enum value (what the user would use from Lua).
  scopePath | The list of containing classes, going inward from the most outer class.

static void gameplay::ScriptUtil::registerFunction | ( | const char * | luaFunction,
|  | lua_CFunction | cppFunction
| ) |  | `[static]`

Register a function with Lua.

Parameters:

  luaFunction | The name of the function from within Lua.
  cppFunction | The C++ function pointer.

static void gameplay::ScriptUtil::registerLibrary | ( | const char * | name,
|  | const luaL_Reg * | functions
| ) |  | `[static]`

Registers the given library with Lua.

Parameters:

  name | The name of the library from within Lua.
  functions | The library function mapping (Lua function names to C++ functions).

static void gameplay::ScriptUtil::setGlobalHierarchyPair | ( | const std::string & | base,
|  | const std::string & | derived
| ) |  | `[static]`

Sets an inheritance pair within the global inheritance hierarchy (base, derived).

Parameters:

  base | The base class of the inheritance pair.
  derived | The derived class of the inheritance pair.

All Classes Functions Variables Typedefs Enumerations Enumerator