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

Lua support for cocos2d-x. More...

#include <CCLuaEngine.h>

Inheritance diagram for CCLuaEngine:
CCScriptEngineProtocol

Public Member Functions

virtual ~CCLuaEngine (void)
virtual ccScriptType getScriptType ()
 Get script type. More...
 
CCLuaStackgetLuaStack (void)
virtual void addSearchPath (const char *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 void removeScriptObjectByCCObject (CCObject *pObj)
 Remove CCObject 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...
 
virtual int executeGlobalFunction (const char *functionName)
 Execute a scripted global function. More...
 
virtual int executeNodeEvent (CCNode *pNode, int nAction)
 Execute a node event function. More...
 
virtual int executeMenuItemEvent (CCMenuItem *pMenuItem)
virtual int executeNotificationEvent (CCNotificationCenter *pNotificationCenter, const char *pszName)
 Execute a notification event function. More...
 
virtual int executeCallFuncActionEvent (CCCallFunc *pAction, CCObject *pTarget=NULL)
 execute a callfun event More...
 
virtual int executeSchedule (int nHandler, float dt, CCNode *pNode=NULL)
 execute a schedule function More...
 
virtual int executeLayerTouchesEvent (CCLayer *pLayer, int eventType, CCSet *pTouches)
 functions for executing touch event More...
 
virtual int executeLayerTouchEvent (CCLayer *pLayer, int eventType, CCTouch *pTouch)
virtual int executeLayerKeypadEvent (CCLayer *pLayer, int eventType)
 functions for keypad event More...
 
virtual int executeAccelerometerEvent (CCLayer *pLayer, CCAcceleration *pAccelerationValue)
 execute a accelerometer event More...
 
virtual int executeEvent (int nHandler, const char *pEventName, CCObject *pEventSource=NULL, const char *pEventSourceClassName=NULL)
 function for common event More...
 
int executeTableViewEvent (int nEventType, cocos2d::extension::CCTableView *pTableView, void *pValue=NULL, CCArray *pResultArray=NULL)
virtual int executeEventWithArgs (int nHandler, CCArray *pArgs)
 function for c++ call back lua funtion More...
 
virtual bool handleAssert (const char *msg)
 called by CCAssert to allow scripting engine to handle failed assertions More...
 
virtual bool parseConfig (CCScriptEngineProtocol::ConfigType type, const std::string &str)
- Public Member Functions inherited from CCScriptEngineProtocol
virtual ~CCScriptEngineProtocol ()

Static Public Member Functions

static CCLuaEnginedefaultEngine (void)

Additional Inherited Members

- Public Types inherited from CCScriptEngineProtocol
enum  ConfigType { NONE, COCOSTUDIO }
 

Detailed Description

Lua support for cocos2d-x.

Constructor & Destructor Documentation

virtual ~CCLuaEngine ( void  )
virtual

Member Function Documentation

virtual void addLuaLoader ( lua_CFunction  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
static CCLuaEngine* defaultEngine ( void  )
static
virtual int
executeAccelerometerEvent
( CCLayer pLayer,
CCAcceleration pAccelerationValue 
)
virtual

execute a accelerometer event

Implements CCScriptEngineProtocol.

virtual int
executeCallFuncActionEvent
( CCCallFunc pAction,
CCObject pTarget = NULL 
)
virtual

execute a callfun event

Implements CCScriptEngineProtocol.

virtual int executeEvent ( int  nHandler,
const char *  pEventName,
CCObject pEventSource = NULL,
const char *  pEventSourceClassName = NULL 
)
virtual

function for common event

Implements CCScriptEngineProtocol.

virtual int executeEventWithArgs ( int  nHandler,
CCArray pArgs 
)
virtual

function for c++ call back lua funtion

Reimplemented from CCScriptEngineProtocol.

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 CCScriptEngineProtocol.

virtual int executeLayerKeypadEvent ( CCLayer pLayer,
int  eventType 
)
virtual

functions for keypad event

Implements CCScriptEngineProtocol.

virtual int
executeLayerTouchesEvent
( CCLayer pLayer,
int  eventType,
CCSet pTouches 
)
virtual

functions for executing touch event

Implements CCScriptEngineProtocol.

virtual int executeLayerTouchEvent ( CCLayer pLayer,
int  eventType,
CCTouch pTouch 
)
virtual
virtual int executeMenuItemEvent ( CCMenuItem pMenuItem)
virtual
virtual int executeNodeEvent ( CCNode pNode,
int  nAction 
)
virtual

Execute a node event function.

Parameters
pNodewhich node produce this event
nActionkCCNodeOnEnter,kCCNodeOnExit,kCCMenuItemActivated,kCCNodeOnEnterTransitionDidFinish,kCCNodeOnExitTransitionDidStart
Returns
The integer value returned from the script function.

Implements CCScriptEngineProtocol.

virtual int
executeNotificationEvent
( CCNotificationCenter pNotificationCenter,
const char *  pszName 
)
virtual

Execute a notification event function.

Implements CCScriptEngineProtocol.

virtual int executeSchedule ( int  nHandler,
float  dt,
CCNode pNode = NULL 
)
virtual

execute a schedule function

Implements CCScriptEngineProtocol.

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 CCScriptEngineProtocol.

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 CCScriptEngineProtocol.

int executeTableViewEvent ( int  nEventType,
cocos2d::extension::CCTableView pTableView,
void *  pValue = NULL,
CCArray pResultArray = NULL 
)
CCLuaStack* getLuaStack ( void  )
inline
virtual ccScriptType getScriptType ( )
inlinevirtual

Get script type.

Reimplemented from CCScriptEngineProtocol.

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 CCScriptEngineProtocol.

virtual bool parseConfig ( CCScriptEngineProtocol::ConfigType  type,
const std::string &  str 
)
virtual
virtual int reallocateScriptHandler ( int  nHandler)
virtual

Reallocate Lua function reference.

Reimplemented from CCScriptEngineProtocol.

virtual void removeScriptHandler ( int  nHandler)
virtual

Remove Lua function reference.

Reimplemented from CCScriptEngineProtocol.

virtual void
removeScriptObjectByCCObject
( CCObject pObj)
virtual

Remove CCObject from lua state.

Parameters
objectto remove

Implements CCScriptEngineProtocol.


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