From 3c1736ebf8955e470c2e9f2c2fec59937a0f1ba0 Mon Sep 17 00:00:00 2001
From: Lactozilla <jp6781615@gmail.com>
Date: Sat, 24 Aug 2024 19:26:01 -0300
Subject: [PATCH] Fix #1277

---
 src/deh_lua.c  | 6 ++++++
 src/dehacked.c | 9 ++++-----
 2 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/src/deh_lua.c b/src/deh_lua.c
index 64fb52fc74..0a4d7d0a9d 100644
--- a/src/deh_lua.c
+++ b/src/deh_lua.c
@@ -28,6 +28,12 @@ static inline int lib_freeslot(lua_State *L)
 	if (!lua_lumploading)
 		return luaL_error(L, "This function cannot be called from within a hook or coroutine!");
 
+	if (!deh_loaded)
+	{
+		initfreeslots();
+		deh_loaded = true;
+	}
+
 	while (n-- > 0)
 	{
 		s = Z_StrDup(luaL_checkstring(L,1));
diff --git a/src/dehacked.c b/src/dehacked.c
index 2050a117f6..63656753db 100644
--- a/src/dehacked.c
+++ b/src/dehacked.c
@@ -192,7 +192,10 @@ static void DEH_LoadDehackedFile(MYFILE *f, boolean mainfile)
 	INT32 i;
 
 	if (!deh_loaded)
+	{
 		initfreeslots();
+		deh_loaded = true;
+	}
 
 	deh_num_warning = 0;
 
@@ -605,14 +608,10 @@ static void DEH_LoadDehackedFile(MYFILE *f, boolean mainfile)
 	if (deh_num_warning)
 	{
 		CONS_Printf(M_GetText("%d warning%s in the SOC lump\n"), deh_num_warning, deh_num_warning == 1 ? "" : "s");
-		if (devparm) {
+		if (devparm)
 			I_Error("%s%s",va(M_GetText("%d warning%s in the SOC lump\n"), deh_num_warning, deh_num_warning == 1 ? "" : "s"), M_GetText("See log.txt for details.\n"));
-			//while (!I_GetKey())
-				//I_OsPolling();
-		}
 	}
 
-	deh_loaded = true;
 	Z_Free(s);
 }
 
-- 
GitLab