Skip to content

Hotfix for "LUA PANIC" crash when joining a netgame

Monster Iestyn requested to merge lua-archive-crash-hotfixes into next

Turns out that it's possible to cause Lua to panic by setting a function, thread or light userdata (or otherwise unrecognised data type) as a table's key. When the server tries to write one of these data types to the $$$.sav for someone joining the netgame, these are instead written as nil type. At the other end, for the person joining the netgame, a "LUA PANIC" crash occurs because of a table key being nil when fed into lua_rawset (a function that actually sets table[key] = value for a particular table).

Now, you just get a bunch of console errors for both the server and joiners, to alert both somebody goofed up a Lua script by using any of those unaccepted key types. (Or perhaps corrupted the savegame) But the game should run fine otherwise, not crash.

Merge request reports