The Lua engine integrated into the cocos2d-x to process the interactive operation between lua and c++. More...
#include <CCLuaEngine.h>
Public Member Functions | |
virtual | ~LuaEngine (void) |
Destrutor of LuaEngine. More... | |
virtual ccScriptType | getScriptType () override |
Get ccScriptType of LuaEngine used, it is always kScriptTypeLua. More... | |
LuaStack * | getLuaStack (void) |
Get LuaStack of the LuaEngine. More... | |
virtual void | addSearchPath (const char *path) |
Add a path to find lua files in. More... | |
local | addSearchPath ( local path) |
Add a path to find lua files in. More... | |
virtual void | addLuaLoader (lua_CFunction func) |
Add lua loader. More... | |
var | addLuaLoader ( var func) |
Add lua loader. More... | |
local | addLuaLoader ( local func) |
Add lua loader. More... | |
virtual int | reload (const char *moduleFileName) |
Reload script code corresponding to moduleFileName. More... | |
local | reload ( local moduleFileName) |
Reload script code corresponding to moduleFileName. More... | |
virtual void | removeScriptObjectByObject (Ref *object) override |
Remove the related reference about the Ref object stored in the Lua table by set the value of corresponding key nil: The related Lua tables are toluafix_refid_ptr_mapping,toluafix_refid_type_mapping,tolua_value_root and object_Metatable["tolua_ubox"] or tolua_ubox. More... | |
virtual void | removeScriptHandler (int nHandler) override |
Remove Lua function reference by nHandler by setting toluafix_refid_function_mapping[nHandle] nil. More... | |
local | removeScriptHandler ( local nHandler) |
Remove Lua function reference by nHandler by setting toluafix_refid_function_mapping[nHandle] nil. More... | |
virtual int | reallocateScriptHandler (int nHandler) override |
Reallocate Lua function reference index to the Lua function pointer to add refrence. More... | |
virtual int | executeString (const char *codes) override |
Execute script code contained in the given string. More... | |
virtual int | executeScriptFile (const char *filename) override |
Execute a script file. More... | |
virtual int | executeGlobalFunction (const char *functionName) override |
Execute a scripted global function. More... | |
virtual int | executeNodeEvent (Node *pNode, int nAction) |
local | executeNodeEvent ( local pNode, local nAction) |
virtual int | executeMenuItemEvent (MenuItem *pMenuItem) |
virtual int | executeNotificationEvent (__NotificationCenter *pNotificationCenter, const char *pszName) |
local | executeNotificationEvent ( local pNotificationCenter, local pszName) |
virtual int | executeCallFuncActionEvent (CallFunc *pAction, Ref *pTarget=NULL) |
var | executeCallFuncActionEvent ( var pAction, var NULL) |
local | executeCallFuncActionEvent ( local pAction, local NULL) |
virtual int | executeSchedule (int nHandler, float dt, Node *pNode=NULL) |
virtual int | executeLayerTouchesEvent (Layer *pLayer, int eventType, __Set *pTouches) |
local | executeLayerTouchesEvent ( local pLayer, local eventType, local pTouches) |
virtual int | executeLayerTouchEvent (Layer *pLayer, int eventType, Touch *pTouch) |
local | executeLayerTouchEvent ( local pLayer, local eventType, local pTouch) |
virtual int | executeLayerKeypadEvent (Layer *pLayer, int eventType) |
local | executeLayerKeypadEvent ( local pLayer, local eventType) |
virtual int | executeAccelerometerEvent (Layer *pLayer, Acceleration *pAccelerationValue) |
virtual int | executeEvent (int nHandler, const char *pEventName, Ref *pEventSource=NULL, const char *pEventSourceClassName=NULL) |
local | executeEvent ( local nHandler, local pEventName, local NULL, local NULL) |
virtual bool | handleAssert (const char *msg) override |
Handle the assert message. More... | |
virtual bool | parseConfig (ConfigType type, const std::string &str) override |
Parse the config information data. More... | |
local | parseConfig ( local type, local str) |
Parse the config information data. More... | |
virtual int | sendEvent (ScriptEvent *message) override |
When some events triggered in the c++ also needs to pass on to lua to handle, we could call this function to send events. More... | |
var | sendEvent ( var message) |
When some events triggered in the c++ also needs to pass on to lua to handle, we could call this function to send events. More... | |
local | sendEvent ( local message) |
When some events triggered in the c++ also needs to pass on to lua to handle, we could call this function to send events. More... | |
virtual int | handleEvent (ScriptHandlerMgr::HandlerType type, void *data) |
Pass on the events related with ScrollView,TableCell,AssertManager, Armature, Accelerometer, Keyboard, Touch, Touches ,Mouse and Custom event to lua to handle. More... | |
local | handleEvent ( local type, local data) |
Pass on the events related with ScrollView,TableCell,AssertManager, Armature, Accelerometer, Keyboard, Touch, Touches ,Mouse and Custom event to lua to handle. More... | |
virtual int | handleEvent (ScriptHandlerMgr::HandlerType type, void *data, int numResults, const std::function< void(lua_State *, int)> &func) |
Pass on the events related with TableCell and TableView to lua to handle. More... | |
Static Public Member Functions | |
static LuaEngine * | getInstance (void) |
Get instance of LuaEngine. More... | |
local | getInstance () |
Get instance of LuaEngine. More... | |
static LuaEngine * | defaultEngine (void) |
Get defaultEngine of LuaEngine, it was deprecated. More... | |
local | defaultEngine () |
Get defaultEngine of LuaEngine, it was deprecated. More... | |
The Lua engine integrated into the cocos2d-x to process the interactive operation between lua and c++.
|
virtual |
Add lua loader.
func | a function pointer point to the loader function. |
|
virtual |
Add lua loader.
func | a function pointer point to the loader function. |
|
virtual |
Add lua loader.
func | a function pointer point to the loader function. |
|
virtual |
Add a path to find lua files in.
path | to be added to the Lua path |
|
virtual |
Add a path to find lua files in.
path | to be added to the Lua path |
|
virtual |
Add a path to find lua files in.
path | to be added to the Lua path |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
virtual |
|
virtual |
|
virtual |
|
virtual |
|
virtual |
|
virtual |
|
virtual |
|
virtual |
|
overridevirtual |
Execute a scripted global function.
The function should not take any parameters and should return an integer.
functionName | String object holding the name of the function, in the global script environment, that is to be executed. |
|
overridevirtual |
Execute a scripted global function.
The function should not take any parameters and should return an integer.
functionName | String object holding the name of the function, in the global script environment, that is to be executed. |
|
overridevirtual |
Execute a scripted global function.
The function should not take any parameters and should return an integer.
functionName | String object holding the name of the function, in the global script environment, that is to be executed. |
|
virtual |
|
virtual |
|
virtual |
|
virtual |
|
virtual |
|
virtual |
|
virtual |
|
virtual |
|
virtual |
|
virtual |
|
virtual |
|
virtual |
|
virtual |
|
virtual |
|
virtual |
|
virtual |
|
virtual |
|
virtual |
|
virtual |
|
overridevirtual |
Execute a script file.
filename | String object holding the filename of the script file that is to be executed. |
|
overridevirtual |
Execute a script file.
filename | String object holding the filename of the script file that is to be executed. |
|
overridevirtual |
Execute a script file.
filename | String object holding the filename of the script file that is to be executed. |
|
overridevirtual |
Execute script code contained in the given string.
codes | holding the valid script code that should be executed. |
|
overridevirtual |
Execute script code contained in the given string.
codes | holding the valid script code that should be executed. |
|
overridevirtual |
Execute script code contained in the given string.
codes | holding the valid script code that should be executed. |
|
static |
|
inline |
|
inline |
|
inline |
|
inlineoverridevirtual |
Get ccScriptType of LuaEngine used, it is always kScriptTypeLua.
|
inlineoverridevirtual |
Get ccScriptType of LuaEngine used, it is always kScriptTypeLua.
|
inlineoverridevirtual |
Get ccScriptType of LuaEngine used, it is always kScriptTypeLua.
|
overridevirtual |
Handle the assert message.
|
overridevirtual |
Handle the assert message.
|
overridevirtual |
Handle the assert message.
|
virtual |
Pass on the events related with ScrollView,TableCell,AssertManager, Armature, Accelerometer, Keyboard, Touch, Touches ,Mouse and Custom event to lua to handle.
type | Different ScriptHandlerMgr::HandlerType means different processing for the data. |
data | The pointer point to the information which should be pass on to lua, it would be parsed in the function to convert to the specific data according to the ScriptHandlerMgr::HandlerType,then pass to lua as function parameters. |
|
virtual |
Pass on the events related with ScrollView,TableCell,AssertManager, Armature, Accelerometer, Keyboard, Touch, Touches ,Mouse and Custom event to lua to handle.
type | Different ScriptHandlerMgr::HandlerType means different processing for the data. |
data | The pointer point to the information which should be pass on to lua, it would be parsed in the function to convert to the specific data according to the ScriptHandlerMgr::HandlerType,then pass to lua as function parameters. |
|
virtual |
Pass on the events related with ScrollView,TableCell,AssertManager, Armature, Accelerometer, Keyboard, Touch, Touches ,Mouse and Custom event to lua to handle.
type | Different ScriptHandlerMgr::HandlerType means different processing for the data. |
data | The pointer point to the information which should be pass on to lua, it would be parsed in the function to convert to the specific data according to the ScriptHandlerMgr::HandlerType,then pass to lua as function parameters. |
|
virtual |
Pass on the events related with TableCell and TableView to lua to handle.
type | Different ScriptHandlerMgr::HandlerType means different processing for the data. |
data | The pointer point to the information which should be pass on to lua, it would be parsed in the function to convert to the specific data according to the ScriptHandlerMgr::HandlerType,then pass to lua as function parameters. |
numResults | The number of the return values. |
func | The callback would be called when numResults is > 0. |
|
virtual |
Pass on the events related with TableCell and TableView to lua to handle.
type | Different ScriptHandlerMgr::HandlerType means different processing for the data. |
data | The pointer point to the information which should be pass on to lua, it would be parsed in the function to convert to the specific data according to the ScriptHandlerMgr::HandlerType,then pass to lua as function parameters. |
numResults | The number of the return values. |
func | The callback would be called when numResults is > 0. |
|
virtual |
Pass on the events related with TableCell and TableView to lua to handle.
type | Different ScriptHandlerMgr::HandlerType means different processing for the data. |
data | The pointer point to the information which should be pass on to lua, it would be parsed in the function to convert to the specific data according to the ScriptHandlerMgr::HandlerType,then pass to lua as function parameters. |
numResults | The number of the return values. |
func | The callback would be called when numResults is > 0. |
|
overridevirtual |
Parse the config information data.
type | in current mechanism,it always ConfigType::COCOSTUDIO. |
str | the information data. |
|
overridevirtual |
Parse the config information data.
type | in current mechanism,it always ConfigType::COCOSTUDIO. |
str | the information data. |
|
overridevirtual |
Parse the config information data.
type | in current mechanism,it always ConfigType::COCOSTUDIO. |
str | the information data. |
|
overridevirtual |
Reallocate Lua function reference index to the Lua function pointer to add refrence.
nHandler | the function refrence index to find the correspoinding Lua function pointer. |
|
overridevirtual |
Reallocate Lua function reference index to the Lua function pointer to add refrence.
nHandler | the function refrence index to find the correspoinding Lua function pointer. |
|
overridevirtual |
Reallocate Lua function reference index to the Lua function pointer to add refrence.
nHandler | the function refrence index to find the correspoinding Lua function pointer. |
|
virtual |
Reload script code corresponding to moduleFileName.
If value of package["loaded"][moduleFileName] is existed, it would set the vaule nil.Then,it calls executeString function.
moduleFileName | String object holding the filename of the script file that is to be executed. |
|
virtual |
Reload script code corresponding to moduleFileName.
If value of package["loaded"][moduleFileName] is existed, it would set the vaule nil.Then,it calls executeString function.
moduleFileName | String object holding the filename of the script file that is to be executed. |
|
virtual |
Reload script code corresponding to moduleFileName.
If value of package["loaded"][moduleFileName] is existed, it would set the vaule nil.Then,it calls executeString function.
moduleFileName | String object holding the filename of the script file that is to be executed. |
|
overridevirtual |
Remove Lua function reference by nHandler by setting toluafix_refid_function_mapping[nHandle] nil.
nHandler | the function refrence index to find the correspoinding Lua function pointer. |
|
overridevirtual |
Remove Lua function reference by nHandler by setting toluafix_refid_function_mapping[nHandle] nil.
nHandler | the function refrence index to find the correspoinding Lua function pointer. |
|
overridevirtual |
Remove Lua function reference by nHandler by setting toluafix_refid_function_mapping[nHandle] nil.
nHandler | the function refrence index to find the correspoinding Lua function pointer. |
|
overridevirtual |
Remove the related reference about the Ref object stored in the Lua table by set the value of corresponding key nil: The related Lua tables are toluafix_refid_ptr_mapping,toluafix_refid_type_mapping,tolua_value_root and object_Metatable["tolua_ubox"] or tolua_ubox.
Meanwhile set the corresponding userdata nullptr and remove the all the lua function refrence corresponding to this object.
In current mechanism, this function is called in the destructor of Ref object, developer don't call this functions.
object | the key object to remove script object. |
|
overridevirtual |
Remove the related reference about the Ref object stored in the Lua table by set the value of corresponding key nil: The related Lua tables are toluafix_refid_ptr_mapping,toluafix_refid_type_mapping,tolua_value_root and object_Metatable["tolua_ubox"] or tolua_ubox.
Meanwhile set the corresponding userdata nullptr and remove the all the lua function refrence corresponding to this object.
In current mechanism, this function is called in the destructor of Ref object, developer don't call this functions.
object | the key object to remove script object. |
|
overridevirtual |
Remove the related reference about the Ref object stored in the Lua table by set the value of corresponding key nil: The related Lua tables are toluafix_refid_ptr_mapping,toluafix_refid_type_mapping,tolua_value_root and object_Metatable["tolua_ubox"] or tolua_ubox.
Meanwhile set the corresponding userdata nullptr and remove the all the lua function refrence corresponding to this object.
In current mechanism, this function is called in the destructor of Ref object, developer don't call this functions.
object | the key object to remove script object. |
|
overridevirtual |
When some events triggered in the c++ also needs to pass on to lua to handle, we could call this function to send events.
message | the ScriptEvent object that has ScriptEventType and the pointer to information data. |
|
overridevirtual |
When some events triggered in the c++ also needs to pass on to lua to handle, we could call this function to send events.
message | the ScriptEvent object that has ScriptEventType and the pointer to information data. |
|
overridevirtual |
When some events triggered in the c++ also needs to pass on to lua to handle, we could call this function to send events.
message | the ScriptEvent object that has ScriptEventType and the pointer to information data. |