Remove unnecessary lua_pushlightuserdata usage, use commandInterface global instead

This causes a crash when using luajit on aarch64 Android builds. I didn't remove the lua_pushlightuserdata usage in LuaLuna.h because that's external code and beyond my understanding
This commit is contained in:
jacob1 2023-10-24 22:12:11 -04:00
parent 7d337ab732
commit d5681d8ed9
No known key found for this signature in database
GPG Key ID: 4E58A32D510E1995
3 changed files with 2 additions and 12 deletions

View File

@ -18,10 +18,7 @@ LuaComponent::LuaComponent(lua_State * l) : component(nullptr), owner_ref(LUA_RE
{
this->l = l; // I don't get how this doesn't cause crashes later on
lua_pushliteral(l, "Luacon_ci");
lua_gettable(l, LUA_REGISTRYINDEX);
ci = (LuaScriptInterface*)lua_touserdata(l, -1);
lua_pop(l, 1);
ci = static_cast<LuaScriptInterface *>(commandInterface);
}
int LuaComponent::position(lua_State * l)

View File

@ -297,10 +297,6 @@ LuaScriptInterface::LuaScriptInterface(GameController * c, GameModel * m):
luaopen_bit(l);
lua_pop(l, 1);
lua_pushliteral(l, "Luacon_ci");
lua_pushlightuserdata(l, this);
lua_settable(l, LUA_REGISTRYINDEX);
initSimulationAPI();
initInterfaceAPI();
SetWindow(c->GetView());

View File

@ -53,10 +53,7 @@ LuaWindow::LuaWindow(lua_State * l)
if (sizeY < 10)
sizeY = 10;
lua_pushliteral(l, "Luacon_ci");
lua_gettable(l, LUA_REGISTRYINDEX);
ci = (LuaScriptInterface*)lua_touserdata(l, -1);
lua_pop(l, 1);
ci = static_cast<LuaScriptInterface *>(commandInterface);
class DrawnWindow : public ui::Window
{