cocos2d-x  3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
LuaJavaBridge Class Reference

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

#include <CCLuaJavaBridge.h>

Static Public Member Functions

static int retainLuaFunctionById (int functionId)
 Add a reference count for the Lua functionId,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, 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 callLuaFunctionById ( int  functionId,
const char *  arg 
)
static

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

Parameters
functionIdthe values corresponding to the Lua function.
argthe string pointer point to the argument.
Returns
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.
static int callLuaGlobalFunction ( const char *  functionName,
const char *  arg 
)
static

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

Parameters
functionNamethe name of global function.
argthe string pointer point to the argument.
Returns
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.
static int releaseLuaFunctionById ( int  functionId)
static

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

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

Parameters
functionIdthe id of Lua function.
Returns
the reference count of the functionId if the luaj_function_id table, the luaj_function_id_retain table and the corresponding value for functionId exists a reference count for the Lua functionId is still greater than 0,and otherwise return 0.
static int retainLuaFunctionById ( int  functionId)
static

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

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

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