lua调用c++

来源:互联网 发布:流量充值系统源码 编辑:程序博客网 时间:2024/06/06 05:03

1. 写pkg文件(就是.h中的public 部分)

2. tolua++ -o "LocalizationManagerLua.cpp" LocalizationManager.pkg 得到导入cpp文件

3. 在appdelegate.cpp中加入两句话

TOLUA_API int luaopen_BattleLayer (lua_State* tolua_S);

luaopen_BattleLayer(pStatck->getLuaState());


或者在toluaapi.h中这么写

#define LUA_CLASS_TABLE \
{ \
LUA_CLASS(CCHTMLLabel) \
}



0 0