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

#include <CCLuaStack.h>

Inheritance diagram for LuaStack:
Ref

Public Member Functions

virtual ~LuaStack ()
lua_StategetLuaState (void)
 Method used to get a pointer to the lua_State that the script module is attached to. More...
 
local getLuaState ()
 Method used to get a pointer to the lua_State that the script module is attached to. 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, now it is used on android. More...
 
local addLuaLoader ( local 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...
 
virtual void removeScriptObjectByObject (Ref *object)
 Remove Object from lua state. More...
 
virtual void removeScriptHandler (int nHandler)
 Remove Lua function reference. More...
 
virtual int reallocateScriptHandler (int nHandler)
 Remove 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...
 
local executeGlobalFunction ( local functionName)
 Execute a scripted global function. More...
 
virtual void clean (void)
virtual void pushInt (int intValue)
local pushInt ( local intValue)
virtual void pushFloat (float floatValue)
local pushFloat ( local floatValue)
virtual void pushLong (long longValue)
local pushLong ( local longValue)
virtual void pushBoolean (bool boolValue)
local pushBoolean ( local boolValue)
virtual void pushString (const char *stringValue)
local pushString ( local stringValue)
virtual void pushString (const char *stringValue, int length)
var pushString ( var stringValue, var length)
local pushString ( local stringValue, local length)
virtual void pushNil (void)
virtual void pushObject (Ref *objectValue, const char *typeName)
local pushObject ( local objectValue, local typeName)
virtual void pushLuaValue (const LuaValue &value)
local pushLuaValue ( local value)
virtual void pushLuaValueDict (const LuaValueDict &dict)
local pushLuaValueDict ( local dict)
virtual void pushLuaValueArray (const LuaValueArray &array)
virtual bool pushFunctionByHandler (int nHandler)
virtual int executeFunction (int numArgs)
virtual int executeFunctionByHandler (int nHandler, int numArgs)
local executeFunctionByHandler ( local nHandler, local numArgs)
virtual int executeFunctionReturnArray (int handler, int numArgs, int numResults, __Array &resultArray)
local executeFunctionReturnArray ( local handler, local numArgs, local numResults, local resultArray)
virtual int executeFunction (int handler, int numArgs, int numResults, const std::function< void(lua_State *, int)> &func)
local executeFunction ( local handler, local numArgs, local numResults, local func)
virtual bool handleAssert (const char *msg)
- Public Member Functions inherited from Ref
void retain ()
 Retains the ownership. More...
 
void release ()
 Release the ownership immediately. More...
 
local release ()
 Release the ownership immediately. More...
 
Refautorelease ()
 Release the ownership sometime soon automatically. More...
 
unsigned int getReferenceCount () const
 Returns the Ref's current reference count. More...
 
virtual ~Ref ()

Static Public Member Functions

static LuaStackcreate (void)
static LuaStackattach (lua_State *L)
var attach ( var L)

Protected Member Functions

 LuaStack (void)
bool init (void)
bool initWithLuaState (lua_State *L)
var initWithLuaState ( var L)
local initWithLuaState ( local L)
- Protected Member Functions inherited from Ref
 Ref ()
 Constructor. More...
 
 Ref ()
 Constructor. More...
 

Protected Attributes

lua_State_state
int _callFromLua
var _callFromLua
local _callFromLua
- Protected Attributes inherited from Ref
unsigned int _referenceCount
 count of references More...
 

Constructor & Destructor Documentation

virtual ~LuaStack ( )
virtual
var ~LuaStack ( )
virtual
local ~LuaStack ( )
virtual
LuaStack ( void  )
inlineprotected
var LuaStack (   )
inlineprotected
local LuaStack (   )
inlineprotected

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 LuaStack* attach ( lua_State L)
static
var attach ( var  L)
static
local attach ( local  L)
static
virtual void clean ( void  )
virtual
var clean (   )
virtual
local clean (   )
virtual
static LuaStack* create ( void  )
static
var create (   )
static
local create (   )
static
virtual int executeFunction ( int  numArgs)
virtual
var executeFunction ( var  numArgs)
virtual
local executeFunction ( local  numArgs)
virtual
virtual int executeFunction ( int  handler,
int  numArgs,
int  numResults,
const std::function< void(lua_State *, int)> &  func 
)
virtual
var executeFunction ( var  handler,
var  numArgs,
var  numResults,
var  func 
)
virtual
local executeFunction ( local  handler,
local  numArgs,
local  numResults,
local  func 
)
virtual
virtual int
executeFunctionByHandler
( int  nHandler,
int  numArgs 
)
virtual
var executeFunctionByHandler ( var  nHandler,
var  numArgs 
)
virtual
local executeFunctionByHandler ( local  nHandler,
local  numArgs 
)
virtual
virtual int
executeFunctionReturnArray
( int  handler,
int  numArgs,
int  numResults,
__Array resultArray 
)
virtual
var executeFunctionReturnArray ( var  handler,
var  numArgs,
var  numResults,
var  resultArray 
)
virtual
local executeFunctionReturnArray ( local  handler,
local  numArgs,
local  numResults,
local  resultArray 
)
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 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.
lua_State* getLuaState ( void  )
inline

Method used to get a pointer to the lua_State that the script module is attached to.

Returns
A pointer to the lua_State that the script module is attached to.
var getLuaState (   )
inline

Method used to get a pointer to the lua_State that the script module is attached to.

Returns
A pointer to the lua_State that the script module is attached to.
local getLuaState (   )
inline

Method used to get a pointer to the lua_State that the script module is attached to.

Returns
A pointer to the lua_State that the script module is attached to.
virtual bool handleAssert ( const char *  msg)
virtual
var handleAssert ( var  msg)
virtual
local handleAssert ( local  msg)
virtual
bool init ( void  )
protected
var init (   )
protected
local init (   )
protected
bool initWithLuaState ( lua_State L)
protected
var initWithLuaState ( var  L)
protected
local initWithLuaState ( local  L)
protected
virtual void pushBoolean ( bool  boolValue)
virtual
var pushBoolean ( var  boolValue)
virtual
local pushBoolean ( local  boolValue)
virtual
virtual void pushFloat ( float  floatValue)
virtual
var pushFloat ( var  floatValue)
virtual
local pushFloat ( local  floatValue)
virtual
virtual bool pushFunctionByHandler ( int  nHandler)
virtual
var pushFunctionByHandler ( var  nHandler)
virtual
local pushFunctionByHandler ( local  nHandler)
virtual
virtual void pushInt ( int  intValue)
virtual
var pushInt ( var  intValue)
virtual
local pushInt ( local  intValue)
virtual
virtual void pushLong ( long  longValue)
virtual
var pushLong ( var  longValue)
virtual
local pushLong ( local  longValue)
virtual
virtual void pushLuaValue ( const LuaValue value)
virtual
var pushLuaValue ( var  value)
virtual
local pushLuaValue ( local  value)
virtual
virtual void pushLuaValueArray ( const LuaValueArray array)
virtual
var pushLuaValueArray ( var  array)
virtual
local pushLuaValueArray ( local  array)
virtual
virtual void pushLuaValueDict ( const LuaValueDict dict)
virtual
var pushLuaValueDict ( var  dict)
virtual
local pushLuaValueDict ( local  dict)
virtual
virtual void pushNil ( void  )
virtual
var pushNil (   )
virtual
local pushNil (   )
virtual
virtual void pushObject ( Ref objectValue,
const char *  typeName 
)
virtual
var pushObject ( var  objectValue,
var  typeName 
)
virtual
local pushObject ( local  objectValue,
local  typeName 
)
virtual
virtual void pushString ( const char *  stringValue)
virtual
var pushString ( var  stringValue)
virtual
local pushString ( local  stringValue)
virtual
virtual void pushString ( const char *  stringValue,
int  length 
)
virtual
var pushString ( var  stringValue,
var  length 
)
virtual
local pushString ( local  stringValue,
local  length 
)
virtual
virtual int reallocateScriptHandler ( int  nHandler)
virtual

Remove Lua function reference.

var reallocateScriptHandler ( var  nHandler)
virtual

Remove Lua function reference.

local reallocateScriptHandler ( local  nHandler)
virtual

Remove 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
objectThe object to be removed.
var removeScriptObjectByObject ( var  object)
virtual

Remove Object from lua state.

Parameters
objectThe object to be removed.
local removeScriptObjectByObject ( local  object)
virtual

Remove Object from lua state.

Parameters
objectThe object to be removed.

Member Data Documentation

int _callFromLua
protected
var _callFromLua
protected
local _callFromLua
protected
lua_State* _state
protected
var _state
protected
local _state
protected

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