ScummVM API documentation
Sword25::LuaBindhelper Class Reference

Static Public Member Functions

static bool addFunctionsToLib (lua_State *L, const Common::String &libName, const luaL_reg *functions)
 
static bool addConstantsToLib (lua_State *L, const Common::String &libName, const lua_constant_reg *constants)
 
static bool addMethodsToClass (lua_State *L, const Common::String &className, const luaL_reg *methods)
 
static bool setClassGCHandler (lua_State *L, const Common::String &className, lua_CFunction GCHandler)
 
static Common::String stackDump (lua_State *L)
 
static Common::String tableDump (lua_State *L)
 
static bool getMetatable (lua_State *L, const Common::String &tableName)
 
static void * my_checkudata (lua_State *L, int ud, const char *tname)
 

Member Function Documentation

◆ addFunctionsToLib()

static bool Sword25::LuaBindhelper::addFunctionsToLib ( lua_State L,
const Common::String libName,
const luaL_reg *  functions 
)
static

Registers a set of functions into a Lua library.

Parameters
LA pointer to the Lua VM
LibNameThe name of the library. If this is an empty string, the functions will be added to the global namespace.
FunctionsAn array of function pointers along with their names. The array must be terminated with the enry (0, 0)
Returns
Returns true if successful, otherwise false.

◆ addConstantsToLib()

static bool Sword25::LuaBindhelper::addConstantsToLib ( lua_State L,
const Common::String libName,
const lua_constant_reg constants 
)
static

Adds a set of constants to the Lua library

Parameters
LA pointer to the Lua VM
LibNameThe name of the library. If this is an empty string, the functions will be added to the global namespace.
ConstantsAn array of the constant values along with their names. The array must be terminated with the enry (0, 0)
Returns
Returns true if successful, otherwise false.

◆ addMethodsToClass()

static bool Sword25::LuaBindhelper::addMethodsToClass ( lua_State L,
const Common::String className,
const luaL_reg *  methods 
)
static

Adds a set of methods to a Lua class

Parameters
LA pointer to the Lua VM
ClassNameThe name of the class When the class name specified does not exist, it is created.
MethodsAn array of function pointers along with their method names. The array must be terminated with the enry (0, 0)
Returns
Returns true if successful, otherwise false.

◆ setClassGCHandler()

static bool Sword25::LuaBindhelper::setClassGCHandler ( lua_State L,
const Common::String className,
lua_CFunction  GCHandler 
)
static

Sets the garbage collector callback method when items of a particular class are deleted

Parameters
LA pointer to the Lua VM
ClassNameThe name of the class When the class name specified does not exist, it is created.
GCHandlerA function pointer
Returns
Returns true if successful, otherwise false.

◆ stackDump()

static Common::String Sword25::LuaBindhelper::stackDump ( lua_State L)
static

Returns a string containing a stack dump of the Lua stack

Parameters
LA pointer to the Lua VM

◆ tableDump()

static Common::String Sword25::LuaBindhelper::tableDump ( lua_State L)
static

Returns a string that describes the contents of a table

Parameters
LA pointer to the Lua VM
Remarks
The table must be on the Lua stack to be read out.

The documentation for this class was generated from the following file: