When reloading elements API, set packages.loaded["elements"] to nil to prevent luaL_register from trying to reuse a nilled table. Fixes #189

This commit is contained in:
Simon Robertshaw 2012-09-16 12:01:48 +01:00
parent 8a4d18df49
commit 42ec654f3e

View File

@ -725,6 +725,14 @@ int LuaScriptInterface::elements_loadDefault(lua_State * l)
} }
lua_pushnil(l); lua_pushnil(l);
lua_setglobal(l, "elements"); lua_setglobal(l, "elements");
lua_pushnil(l);
lua_setglobal(l, "elem");
lua_getglobal(l, "package");
lua_getfield(l, -1, "loaded");
lua_pushnil(l);
lua_setfield(l, -2, "elements");
luacon_ci->initElementsAPI(); luacon_ci->initElementsAPI();
} }