Currently, any lua panics cause a engine error and close your game completely.
It would be alot better to make client state lua panics close the state and disconnect the user instead.
When developing modules, this can be really annoying to rejoin the game every time you need to test your client module.
Activity
thegrb93 commentedon Apr 9, 2021
pcall so it doesn't lua panic.
artemking4 commentedon Apr 10, 2021
What if its not you who is causing the lua panic? What if it is some lua? I have seen people do that, for an example you can cause a 'gamemode is not a table' lua panic pretty easily. You can also create custom panics.
robotboy655 commentedon Apr 10, 2021
A lot of stuff like that was already gotten rid of in recent updates (weapons, sents), but the primary concern here is still that the game will just crash in dozen other spots like when I attempted to get rid of the gamemode one.
Also a lot of Lua Panics end users get are the "out of memory" panics, and I'd rather have them see a message saying out of memory rather than just crash in some other random part of the engine that doesn't handle OOM.
artemking4 commentedon Apr 12, 2021
You can still just disconnect the user from the server and close the client state.
For the OOM issue, you can do the same, closing the state (and calling the gc if it doesnt do it by itself) would free up some memory. You can after that test if the issue is gone: allocate the same memory and immeditately delete it, if you can not - fine, just crash then. Otherwise we can assume the issue is gone.