lua_pushstring(L,funcname);
lua_getglobal(L,-1);
lua_pushnumber(L,a);
lua_pcall(L,1,0,0);
有可能使lua堆栈不断增长,所以如果不能确定
堆栈里有什么时,可以用下面的方法来保证堆栈大小。
int top = lua_gettop(luaState);
...
lua_settop(luaState,top);
lua_pushstring(L,funcname);
lua_getglobal(L,-1);
lua_pushnumber(L,a);
lua_pcall(L,1,0,0);
有可能使lua堆栈不断增长,所以如果不能确定
堆栈里有什么时,可以用下面的方法来保证堆栈大小。
int top = lua_gettop(luaState);
...
lua_settop(luaState,top);