需要帮助,在 Visual Studio 2017 C++ 代码中更新 Lua 代码

我有这个代码,在 2005 年是可以运行的,但是似乎 Lua 已经改变了,我承认我被卡住了。

bool SLua::getValue (const char *table, const char *key, int  *result){

lua_getglobal (state_, table);
lua_pushstring (state_, key);
lua_gettable (state_, -2);

*result = lua_tonumber (state_, -1);
lua_pop (state_, 2);

return true; }

我的编译应用程序在每次执行lua_gettable (state_, -2)时都会崩溃,这是由于 Lua 的更改吗?我已经不得不在别处用 luaL_newstate() 交换了lua_open()。

谢谢任何帮助

点赞