I have completely no idea on how it could raise this error: even if the global does not exist, isn't it should give a nil?
Nevertheless, something I could ensure are:
- it is a valid
lua_State
; - it is the main context, not a thread;
- the named global has been set previously, on the same
lua_State
instance. - I never unset the global (as I don't know how to do that).
And this is the stack trace when error is raised:
ZTD3UI.exe!luaD_throw(lua_State * L, int errcode) line 135 C++
ZTD3UI.exe!luaG_errormsg(lua_State * L) line 775 C++
ZTD3UI.exe!luaG_runerror(lua_State * L, const char * fmt, ...) line 789 C++
ZTD3UI.exe!luaG_typeerror(lua_State * L, const TValue * o, const char * op) line 695 C++
ZTD3UI.exe!luaV_finishget(lua_State * L, const TValue * t, TValue * key, StackValue * val, const TValue * slot) line 298 C++
ZTD3UI.exe!auxgetstr(lua_State * L, const TValue * t, const char * k) line 646 C++
ZTD3UI.exe!lua_getglobal(lua_State * L, const char * name) line 665 C++