cocos2d::LuaEngine *engine = cocos2d::LuaEngine::getInstance();
engine->executeGlobalFunction("loginMode2Finished");
```
这样使用CCLuaStack调用乱的全局函数,怎么传递参数到lua端,之前看了CCLuaStack的接口,没有发现传递参数过去的
现在有没有大神在,求帮忙解决一下
//call lua method
auto engine = LuaEngine::getInstance();
lua_State* L = engine->getLuaStack()->getLuaState();
lua_getglobal(L, "loginMode2Finished"); //method name
if (!lua_isfunction(L, -1))
{
CCLOG(" loginMode2Finished should be a function! Please define as a global function in lua");
lua_pop(L, 1);
return false;
}
lua_pushnumber(L, 1); //first params number
lua_pushinteger(L, 2); //second params int
int numArgs = 2; //arg number
int isCallSuccess = engine->getLuaStack()->executeFunction(numArgs);
```
function loginMode2Finished(num, count)
return 1
end
```
真是太谢谢了。搞了一个中午的,看源码也没怎么看懂。thanks