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

#include <CCLuaEngine.h>

Inheritance diagram for LuaEngine:

Public Member Functions

virtual ~LuaEngine (void)
local ~LuaEngine ()
virtual ccScriptType getScriptType ()
local getScriptType ()
LuaStackgetLuaStack (void)
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, now it is used on android. More...
 
virtual int reload (const char *moduleFileName)
 reload script code contained in the given string. More...
 
var reload ( var moduleFileName)
 reload script code contained in the given string. More...
 
local reload ( local moduleFileName)
 reload script code contained in the given string. More...
 
virtual void removeScriptObjectByObject (Ref *object)
 Remove Object from lua state. More...
 
var removeScriptObjectByObject ( var object)
 Remove Object from lua state. More...
 
local removeScriptObjectByObject ( local object)
 Remove Object from lua state. More...
 
virtual void removeScriptHandler (int nHandler)
 Remove Lua function reference. More...
 
virtual int reallocateScriptHandler (int nHandler)
 Reallocate Lua function reference. More...
 
virtual int executeString (const char *codes)
 Execute script code contained in the given string. More...
 
virtual int executeScriptFile (const char *filename)
 Execute a script file. More...
 
local executeScriptFile ( local filename)
 Execute a script file. More...
 
virtual int executeGlobalFunction (const char *functionName)
 Execute a scripted global function. More...
 
local executeGlobalFunction ( local functionName)
 Execute a scripted global function. More...
 
virtual int executeNodeEvent (Node *pNode, int nAction)
var executeNodeEvent ( var pNode, var 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)
var executeSchedule ( var nHandler, var dt, var NULL)
local executeSchedule ( local nHandler, local dt, local 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)
var executeLayerKeypadEvent ( var pLayer, var eventType)
local executeLayerKeypadEvent ( local pLayer, local eventType)
virtual int executeAccelerometerEvent (Layer *pLayer, Acceleration *pAccelerationValue)
 execute a accelerometer event More...
 
local executeAccelerometerEvent ( local pLayer, local pAccelerationValue)
 execute a accelerometer event More...
 
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)
virtual bool parseConfig (ConfigType type, const std::string &str) override
local parseConfig ( local type, local str)
virtual int sendEvent (ScriptEvent *message) override
local sendEvent ( local message)
virtual int handleEvent (ScriptHandlerMgr::HandlerType type, void *data)
local handleEvent ( local type, local data)
virtual int handleEvent (ScriptHandlerMgr::HandlerType type, void *data, int numResults, const std::function< void(lua_State *, int)> &func)
local handleEvent ( local type, local data, local numResults, local func)

Static Public Member Functions

static LuaEnginegetInstance (void)
var getInstance ()
local getInstance ()
static LuaEnginedefaultEngine (void)
local defaultEngine ()

Constructor & Destructor Documentation

virtual ~LuaEngine ( void  )
virtual
var ~LuaEngine (   )
virtual
local ~LuaEngine (   )
virtual

Member Function Documentation

virtual void addLuaLoader ( lua_CFunction  func)
virtual

Add lua loader, now it is used on android.

var addLuaLoader ( var  func)
virtual

Add lua loader, now it is used on android.

local addLuaLoader ( local  func)
virtual

Add lua loader, now it is used on android.

virtual void addSearchPath ( const char *  path)
virtual

Add a path to find lua files in.

Parameters
pathto be added to the Lua path
var addSearchPath ( var  path)
virtual

Add a path to find lua files in.

Parameters
pathto be added to the Lua path
local addSearchPath ( local  path)
virtual

Add a path to find lua files in.

Parameters
pathto be added to the Lua path
static LuaEngine* defaultEngine ( void  )
inlinestatic
var defaultEngine (   )
inlinestatic
local defaultEngine (   )
inlinestatic
virtual int
executeAccelerometerEvent
( Layer pLayer,
Acceleration pAccelerationValue 
)
virtual

execute a accelerometer event

var executeAccelerometerEvent ( var  pLayer,
var  pAccelerationValue 
)
virtual

execute a accelerometer event

local executeAccelerometerEvent ( local  pLayer,
local  pAccelerationValue 
)
virtual

execute a accelerometer event

virtual int
executeCallFuncActionEvent
( CallFunc pAction,
Ref pTarget = NULL 
)
virtual
var executeCallFuncActionEvent ( var  pAction,
var  pTarget = NULL 
)
virtual
local executeCallFuncActionEvent ( local  pAction,
local  pTarget = NULL 
)
virtual
virtual int executeEvent ( int  nHandler,
const char *  pEventName,
Ref pEventSource = NULL,
const char *  pEventSourceClassName = NULL 
)
virtual
var executeEvent ( var  nHandler,
var  pEventName,
var  pEventSource = NULL,
var  pEventSourceClassName = NULL 
)
virtual
local executeEvent ( local  nHandler,
local  pEventName,
local  pEventSource = NULL,
local  pEventSourceClassName = NULL 
)
virtual
virtual int executeGlobalFunction ( const char *  functionName)
virtual

Execute a scripted global function.

The function should not take any parameters and should return an integer.

Parameters
functionNameString object holding the name of the function, in the global script environment, that is to be executed.
Returns
The integer value returned from the script function.
var executeGlobalFunction ( var  functionName)
virtual

Execute a scripted global function.

The function should not take any parameters and should return an integer.

Parameters
functionNameString object holding the name of the function, in the global script environment, that is to be executed.
Returns
The integer value returned from the script function.
local executeGlobalFunction ( local  functionName)
virtual

Execute a scripted global function.

The function should not take any parameters and should return an integer.

Parameters
functionNameString object holding the name of the function, in the global script environment, that is to be executed.
Returns
The integer value returned from the script function.
virtual int executeLayerKeypadEvent ( Layer pLayer,
int  eventType 
)
virtual
var executeLayerKeypadEvent ( var  pLayer,
var  eventType 
)
virtual
local executeLayerKeypadEvent ( local  pLayer,
local  eventType 
)
virtual
virtual int
executeLayerTouchesEvent
( Layer pLayer,
int  eventType,
__Set pTouches 
)
virtual
var executeLayerTouchesEvent ( var  pLayer,
var  eventType,
var  pTouches 
)
virtual
local executeLayerTouchesEvent ( local  pLayer,
local  eventType,
local  pTouches 
)
virtual
virtual int executeLayerTouchEvent ( Layer pLayer,
int  eventType,
Touch pTouch 
)
virtual
var executeLayerTouchEvent ( var  pLayer,
var  eventType,
var  pTouch 
)
virtual
local executeLayerTouchEvent ( local  pLayer,
local  eventType,
local  pTouch 
)
virtual
virtual int executeMenuItemEvent ( MenuItem pMenuItem)
virtual
var executeMenuItemEvent ( var  pMenuItem)
virtual
local executeMenuItemEvent ( local  pMenuItem)
virtual
virtual int executeNodeEvent ( Node pNode,
int  nAction 
)
virtual
var executeNodeEvent ( var  pNode,
var  nAction 
)
virtual
local executeNodeEvent ( local  pNode,
local  nAction 
)
virtual
virtual int
executeNotificationEvent
( __NotificationCenter pNotificationCenter,
const char *  pszName 
)
virtual
var executeNotificationEvent ( var  pNotificationCenter,
var  pszName 
)
virtual
local executeNotificationEvent ( local  pNotificationCenter,
local  pszName 
)
virtual
virtual int executeSchedule ( int  nHandler,
float  dt,
Node pNode = NULL 
)
virtual
var executeSchedule ( var  nHandler,
var  dt,
var  pNode = NULL 
)
virtual
local executeSchedule ( local  nHandler,
local  dt,
local  pNode = NULL 
)
virtual
virtual int executeScriptFile ( const char *  filename)
virtual

Execute a script file.

Parameters
filenameString object holding the filename of the script file that is to be executed
var executeScriptFile ( var  filename)
virtual

Execute a script file.

Parameters
filenameString object holding the filename of the script file that is to be executed
local executeScriptFile ( local  filename)
virtual

Execute a script file.

Parameters
filenameString object holding the filename of the script file that is to be executed
virtual int executeString ( const char *  codes)
virtual

Execute script code contained in the given string.

Parameters
codesholding the valid script code that should be executed.
Returns
0 if the string is excuted correctly.
other if the string is excuted wrongly.
var executeString ( var  codes)
virtual

Execute script code contained in the given string.

Parameters
codesholding the valid script code that should be executed.
Returns
0 if the string is excuted correctly.
other if the string is excuted wrongly.
local executeString ( local  codes)
virtual

Execute script code contained in the given string.

Parameters
codesholding the valid script code that should be executed.
Returns
0 if the string is excuted correctly.
other if the string is excuted wrongly.
static LuaEngine* getInstance ( void  )
static
var getInstance (   )
static
local getInstance (   )
static
LuaStack* getLuaStack ( void  )
inline
var getLuaStack (   )
inline
local getLuaStack (   )
inline
virtual ccScriptType getScriptType ( )
inlinevirtual
var getScriptType ( )
inlinevirtual
local getScriptType ( )
inlinevirtual
virtual bool handleAssert ( const char *  msg)
virtual
var handleAssert ( var  msg)
virtual
local handleAssert ( local  msg)
virtual
virtual int handleEvent ( ScriptHandlerMgr::HandlerType  type,
void *  data 
)
virtual
var handleEvent ( var  type,
var  data 
)
virtual
local handleEvent ( local  type,
local  data 
)
virtual
virtual int handleEvent ( ScriptHandlerMgr::HandlerType  type,
void *  data,
int  numResults,
const std::function< void(lua_State *, int)> &  func 
)
virtual
var handleEvent ( var  type,
var  data,
var  numResults,
var  func 
)
virtual
local handleEvent ( local  type,
local  data,
local  numResults,
local  func 
)
virtual
virtual bool parseConfig ( ConfigType  type,
const std::string &  str 
)
overridevirtual
var parseConfig ( var  type,
var  str 
)
overridevirtual
local parseConfig ( local  type,
local  str 
)
overridevirtual
virtual int reallocateScriptHandler ( int  nHandler)
virtual

Reallocate Lua function reference.

var reallocateScriptHandler ( var  nHandler)
virtual

Reallocate Lua function reference.

local reallocateScriptHandler ( local  nHandler)
virtual

Reallocate Lua function reference.

virtual int reload ( const char *  moduleFileName)
virtual

reload script code contained in the given string.

Parameters
moduleFileNameString object holding the filename of the script file that is to be executed
Returns
0 if the string is excuted correctly.
other if the string is excuted wrongly.
var reload ( var  moduleFileName)
virtual

reload script code contained in the given string.

Parameters
moduleFileNameString object holding the filename of the script file that is to be executed
Returns
0 if the string is excuted correctly.
other if the string is excuted wrongly.
local reload ( local  moduleFileName)
virtual

reload script code contained in the given string.

Parameters
moduleFileNameString object holding the filename of the script file that is to be executed
Returns
0 if the string is excuted correctly.
other if the string is excuted wrongly.
virtual void removeScriptHandler ( int  nHandler)
virtual

Remove Lua function reference.

var removeScriptHandler ( var  nHandler)
virtual

Remove Lua function reference.

local removeScriptHandler ( local  nHandler)
virtual

Remove Lua function reference.

virtual void
removeScriptObjectByObject
( Ref object)
virtual

Remove Object from lua state.

Parameters
objectto remove
var removeScriptObjectByObject ( var  object)
virtual

Remove Object from lua state.

Parameters
objectto remove
local removeScriptObjectByObject ( local  object)
virtual

Remove Object from lua state.

Parameters
objectto remove
virtual int sendEvent ( ScriptEvent *  message)
overridevirtual
var sendEvent ( var  message)
overridevirtual
local sendEvent ( local  message)
overridevirtual

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