2014-03-10 14:04:58 +08:00
|
|
|
|
|
|
|
#ifndef __LUA_OBJC_BRIDGE_H_
|
|
|
|
#define __LUA_OBJC_BRIDGE_H_
|
|
|
|
|
|
|
|
#include "CCLuaBridge.h"
|
|
|
|
|
|
|
|
NS_CC_BEGIN
|
|
|
|
|
2015-03-25 18:54:33 +08:00
|
|
|
/**
|
|
|
|
* Build a bridge between ObjectC and Lua script.
|
|
|
|
* This mechanism make Lua and ObjectC call each other easily.
|
|
|
|
*
|
|
|
|
* @js NA
|
|
|
|
*/
|
2014-03-10 14:04:58 +08:00
|
|
|
class LuaObjcBridge : public LuaBridge
|
|
|
|
{
|
|
|
|
public:
|
2015-03-25 18:54:33 +08:00
|
|
|
/**
|
|
|
|
* Bind callObjcStaticMethod of LuaObjcBridge to Lua.
|
|
|
|
* In current mechanism,we could call LuaObjcBridge.callStaticMethod(className, methodName, args) in Lua directly.
|
|
|
|
* Meanwhile the callObjcStaticMethod of LuaObjcBridge binding function is wrapped in the luaoc.lua
|
|
|
|
*
|
|
|
|
* @param L the current lua_State
|
|
|
|
* @lua NA
|
|
|
|
*/
|
2014-03-10 14:04:58 +08:00
|
|
|
static void luaopen_luaoc(lua_State *L);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
static int callObjcStaticMethod(lua_State *L);
|
|
|
|
|
|
|
|
static void pushValue(lua_State *L, void *val);
|
|
|
|
};
|
|
|
|
NS_CC_END
|
|
|
|
|
|
|
|
#endif // __LUA_OBJC_BRIDGE_H_
|