1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Clean up some getServer() unsafety

This commit is contained in:
sfan5 2024-04-20 19:11:50 +02:00
parent e39e47b21f
commit 58eccc7a2a
3 changed files with 15 additions and 8 deletions

View file

@ -192,8 +192,10 @@ void ServerScripting::InitializeAsync(lua_State *L, int top)
LuaVoxelManip::Register(L);
LuaSettings::Register(L);
// globals data
auto *data = ModApiBase::getServer(L)->m_lua_globals_data.get();
// pull the globals data from the server
auto *server = dynamic_cast<Server*>(ModApiBase::getGameDef(L));
assert(server);
auto *data = server->m_lua_globals_data.get();
assert(data);
script_unpack(L, data);
lua_setfield(L, top, "transferred_globals");