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

Build a bridge between Java and Lua script. More...

Static Public Member Functions

static int retainLuaFunctionById (int functionId)
 Add a reference count for the Lua functionId(+1),and save this reference in the Lua table named luaj_function_id_retain. More...
 
static int releaseLuaFunctionById (int functionId)
 Release a reference count for the Lua functionId(-1).If the reference count is still greater than 0,save this reference in the Lua table named luaj_function_id_retain. More...
 
static int callLuaFunctionById (int functionId, const char *arg)
 Call the Lua function corresponding to the functionId with the string pointer arg. More...
 
static int callLuaGlobalFunction (const char *functionName, const char *arg)
 Call a global Lua function named functionName with the string pointer arg. More...
 

Detailed Description

Build a bridge between Java and Lua script.

This mechanism make Lua and Java call each other easily.

Member Function Documentation

static int retainLuaFunctionById ( int  functionId)
static

Add a reference count for the Lua functionId(+1),and save this reference in the Lua table named luaj_function_id_retain.

the reference id of Lua function. the reference count of the functionId if luaj_function_id_retain table exists and the corresponding value for functionId exists, otherwise return 0.

static int releaseLuaFunctionById ( int  functionId)
static

Release a reference count for the Lua functionId(-1).If the reference count is still greater than 0,save this reference in the Lua table named luaj_function_id_retain.

Otherwise, remove the reference about this functionId in the luaj_function_id table and the luaj_function_id_retain table by set the corresponding value nil.

the reference id of Lua function. the retain count or 0.

static int callLuaFunctionById ( int  functionId,
const char *  arg 
)
static

Call the Lua function corresponding to the functionId with the string pointer arg.

the reference id to the Lua function. the string pointer point to the argument. a number value returned from the Lua function when call sucessfully, otherwise return -1 or the opposite number for one of the three numbers LUA_ERRRUN,LUA_ERRMEM and LUA_ERRERR.

static int callLuaGlobalFunction ( const char *  functionName,
const char *  arg 
)
static

Call a global Lua function named functionName with the string pointer arg.

the name of global function. the string pointer point to the argument. a number value returned frome the Lua function when call sucessfully, otherwise return -1 or the opposite number for one of the three numbers LUA_ERRRUN,LUA_ERRMEM and LUA_ERRERR.


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