Cocos2d-x  v3.10
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Groups
LuaBridge Class Reference

Build bridge between ObjC and Lua. More...

Inherited by LuaObjcBridge.

Static Public Member Functions

static LuaStackgetStack (void)
 Get the LuaStack of LuaEngine. More...
 
static int pushLuaFunctionById (int functionId)
 Push the function pointer corresponding to functionId on the top of lua stack by searching the lua_bridge_function_id table. More...
 
static int retainLuaFunctionById (int functionId)
 The retain count would be increase by 1 corresponding to functionId in the lua_bridge_function_id_retain table if it could be found. More...
 
static int releaseLuaFunctionById (int functionId)
 The retain count would be reduced by 1 corresponding to functionId in the lua_bridge_function_id_retain table if it could be found. More...
 

Detailed Description

Build bridge between ObjC and Lua.

It makes Lua and ObjC can call each other conveniently.

Member Function Documentation

static LuaStack* getStack ( void  )
static

Get the LuaStack of LuaEngine.

the LuaStack object.

static int pushLuaFunctionById ( int  functionId)
static

Push the function pointer corresponding to functionId on the top of lua stack by searching the lua_bridge_function_id table.

If it don't find the function pointer corresponding to functionId, it will reset stack top index to the index before searching.

the value used to search the lua_bridge_function_id table. Return 0 if the lua_bridge_function_id table or the function pointer corresponding to functionId don't exist, otherwise return -1.

static int retainLuaFunctionById ( int  functionId)
static

The retain count would be increase by 1 corresponding to functionId in the lua_bridge_function_id_retain table if it could be found.

If lua_bridge_function_id_retain table is not existed or the type of lua_bridge_function_id_retain[functionId] isn't LUA_TNUMBER, It would return 0. The top index of Lua stack the same as before calling this function.

the value used to search the lua_bridge_function_id_retain table. the retain count or 0.

static int releaseLuaFunctionById ( int  functionId)
static

The retain count would be reduced by 1 corresponding to functionId in the lua_bridge_function_id_retain table if it could be found.

If lua_bridge_function_id table or lua_bridge_function_id_retain aren't existed or the type of lua_bridge_function_id_retain[functionId] isn't LUA_TNUMBER , it would return 0. If the value of retain count is 0 after reducing, it would update the lua_bridge_function_id_retain table and lua_bridge_function_id_retain table to remove the reference corresponding to this functionId

the value used to search the lua_bridge_function_id table and lua_bridge_function_id table. the retain count or 0.


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