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

#include <CCLuaEngine.h>

Inheritance diagram for LuaEngine:
ScriptEngineProtocol

Public Member Functions

virtual ~LuaEngine (void)
virtual ccScriptType getScriptType ()
 Get script type. More...
 
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...
 
local addLuaLoader ( local func)
 Add lua loader, now it is used on android. More...
 
virtual void removeScriptObjectByObject (Object *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...
 
var removeScriptHandler ( var nHandler)
 Remove Lua function reference. More...
 
local removeScriptHandler ( local 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)
virtual int executeMenuItemEvent (MenuItem *pMenuItem)
virtual int executeNotificationEvent (NotificationCenter *pNotificationCenter, const char *pszName)
local executeNotificationEvent ( local pNotificationCenter, local pszName)
virtual int executeCallFuncActionEvent (CallFunc *pAction, Object *pTarget=NULL)
virtual int executeSchedule (int nHandler, float dt, Node *pNode=NULL)
local executeSchedule ( local nHandler, local dt, local NULL)
virtual int executeLayerTouchesEvent (Layer *pLayer, int eventType, Set *pTouches)
virtual int executeLayerTouchEvent (Layer *pLayer, int eventType, Touch *pTouch)
virtual int executeLayerKeypadEvent (Layer *pLayer, int eventType)
virtual int executeAccelerometerEvent (Layer *pLayer, Acceleration *pAccelerationValue)
 execute a accelerometer event More...
 
virtual int executeEvent (int nHandler, const char *pEventName, Object *pEventSource=NULL, const char *pEventSourceClassName=NULL)
virtual bool handleAssert (const char *msg)
 called by CCAssert to allow scripting engine to handle failed assertions More...
 
virtual int sendEvent (ScriptEvent *message)
 when trigger a script event ,call this func,add params needed into ScriptEvent object.nativeObject is object triggering the event, can be NULL in lua More...
 
local sendEvent ( local message)
 when trigger a script event ,call this func,add params needed into ScriptEvent object.nativeObject is object triggering the event, can be NULL in lua More...
 
virtual int sendEventReturnArray (ScriptEvent *message, int numResults, Array &resultArray)
void extendLuaObject ()
- Public Member Functions inherited from ScriptEngineProtocol
virtual ~ScriptEngineProtocol ()

Static Public Member Functions

static LuaEnginegetInstance (void)
local getInstance ()
static CC_DEPRECATED_ATTRIBUTE
LuaEngine
defaultEngine (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 CC_DEPRECATED_ATTRIBUTE
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,
Object 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,
Object 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.

Implements ScriptEngineProtocol.

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.

Implements ScriptEngineProtocol.

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.

Implements ScriptEngineProtocol.

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

Implements ScriptEngineProtocol.

var executeScriptFile ( var  filename)
virtual

Execute a script file.

Parameters
filenameString object holding the filename of the script file that is to be executed

Implements ScriptEngineProtocol.

local executeScriptFile ( local  filename)
virtual

Execute a script file.

Parameters
filenameString object holding the filename of the script file that is to be executed

Implements ScriptEngineProtocol.

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.

Implements ScriptEngineProtocol.

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.

Implements ScriptEngineProtocol.

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.

Implements ScriptEngineProtocol.

void extendLuaObject ( )
var extendLuaObject ( )
local extendLuaObject ( )
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

Get script type.

Reimplemented from ScriptEngineProtocol.

var getScriptType ( )
inlinevirtual

Get script type.

Reimplemented from ScriptEngineProtocol.

local getScriptType ( )
inlinevirtual

Get script type.

Reimplemented from ScriptEngineProtocol.

virtual bool handleAssert ( const char *  msg)
virtual

called by CCAssert to allow scripting engine to handle failed assertions

Returns
true if the assert was handled by the script engine, false otherwise.

Implements ScriptEngineProtocol.

var handleAssert ( var  msg)
virtual

called by CCAssert to allow scripting engine to handle failed assertions

Returns
true if the assert was handled by the script engine, false otherwise.

Implements ScriptEngineProtocol.

local handleAssert ( local  msg)
virtual

called by CCAssert to allow scripting engine to handle failed assertions

Returns
true if the assert was handled by the script engine, false otherwise.

Implements ScriptEngineProtocol.

virtual int reallocateScriptHandler ( int  nHandler)
virtual

Reallocate Lua function reference.

Reimplemented from ScriptEngineProtocol.

var reallocateScriptHandler ( var  nHandler)
virtual

Reallocate Lua function reference.

Reimplemented from ScriptEngineProtocol.

local reallocateScriptHandler ( local  nHandler)
virtual

Reallocate Lua function reference.

Reimplemented from ScriptEngineProtocol.

virtual void removeScriptHandler ( int  nHandler)
virtual

Remove Lua function reference.

Reimplemented from ScriptEngineProtocol.

var removeScriptHandler ( var  nHandler)
virtual

Remove Lua function reference.

Reimplemented from ScriptEngineProtocol.

local removeScriptHandler ( local  nHandler)
virtual

Remove Lua function reference.

Reimplemented from ScriptEngineProtocol.

virtual void
removeScriptObjectByObject
( Object object)
virtual

Remove Object from lua state.

Parameters
objectto remove

Implements ScriptEngineProtocol.

var removeScriptObjectByObject ( var  object)
virtual

Remove Object from lua state.

Parameters
objectto remove

Implements ScriptEngineProtocol.

local removeScriptObjectByObject ( local  object)
virtual

Remove Object from lua state.

Parameters
objectto remove

Implements ScriptEngineProtocol.

virtual int sendEvent ( ScriptEvent evt)
virtual

when trigger a script event ,call this func,add params needed into ScriptEvent object.nativeObject is object triggering the event, can be NULL in lua

Implements ScriptEngineProtocol.

var sendEvent ( var  evt)
virtual

when trigger a script event ,call this func,add params needed into ScriptEvent object.nativeObject is object triggering the event, can be NULL in lua

Implements ScriptEngineProtocol.

local sendEvent ( local  evt)
virtual

when trigger a script event ,call this func,add params needed into ScriptEvent object.nativeObject is object triggering the event, can be NULL in lua

Implements ScriptEngineProtocol.

virtual int sendEventReturnArray ( ScriptEvent message,
int  numResults,
Array resultArray 
)
virtual
var sendEventReturnArray ( var  message,
var  numResults,
var  resultArray 
)
virtual
local sendEventReturnArray ( local  message,
local  numResults,
local  resultArray 
)
virtual

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