Only read/write luavars from demos if Lua state has been initialised.

This commit is contained in:
toaster 2022-10-30 13:29:27 +00:00
parent a6c825dd16
commit 21bfb9753f

View file

@ -6734,7 +6734,7 @@ void G_BeginRecording(void)
demoflags |= DF_ENCORE;
#ifdef HAVE_BLUA
if (!modeattacking) // Ghosts don't read luavars, and you shouldn't ever need to save Lua in replays, you doof!
if (!modeattacking && gL) // Ghosts don't read luavars, and you shouldn't ever need to save Lua in replays, you doof!
// SERIOUSLY THOUGH WHY WOULD YOU LOAD HOSTMOD AND RECORD A GHOST WITH IT !????
demoflags |= DF_LUAVARS;
#endif
@ -6843,7 +6843,7 @@ void G_BeginRecording(void)
#ifdef HAVE_BLUA
// player lua vars, always saved even if empty... Unless it's record attack.
if (!modeattacking)
if (demoflags & DF_LUAVARS)
LUA_ArchiveDemo();
#endif