I've recently updated my old Lua 5.1 project to the newest version of the library, and I'm having problems with LUA_GLOBALSINDEX
- it became undefined. I only used it in lua_getfield
functions, like so:
void luastartgame(void)
{
if(startgamefunction.empty())return ;
lua_getfield(globalL, LUA_GLOBALSINDEX, startgamefunction.c_str()); // go to function in Lua script
int numArgs = 0;
int res = lua_pcall(globalL,numArgs,0, 0);
if(!luaresf(res)) // did the function call result in an error?
{
return;
}
}
I tried replacing it with some constant integers - if it is something other than 0, my program crashes. If it is 0, it runs oddly, complaining about "attempting to access a nil value".
My source cose is available here. How should I handle the LUA_GLOBALSINDEX
? What should I change it to?