I recently upgraded my old Lua 5.1 project to the latest version of the library, and I had problems with LUA_GLOBALSINDEX- it became undefined. I used it only in functions lua_getfield, for example:
void luastartgame(void)
{
if(startgamefunction.empty())return ;
lua_getfield(globalL, LUA_GLOBALSINDEX, startgamefunction.c_str());
int numArgs = 0;
int res = lua_pcall(globalL,numArgs,0, 0);
if(!luaresf(res))
{
return;
}
}
I tried replacing it with some constant integers - if it is something other than 0, my program will crash. If it is 0, it works strangely, complaining of "trying to access the nil value".
My original braid is available here . How to handle LUA_GLOBALSINDEX? What should i change?
source
share