lua_State* L = luaL_newstate()
if(L == NULL)
{
return ;
}
int nRet = luaL_loadfile(L, “hello.lua”)
if(nRet)
{
printf(“nRet is %d\n”, nRet)
return ;
}
…
运行程序,到这里的时候,发现nRet结果为6,这是为什么啊
同遇到这个问题,有答案了嘛
cocos里面可不能直接用lua自带的文件函数,官方并没有替换。可以使用cocos把文件读出来,然后使用 luaL_loadstring
加载