From 5d553a1cfbfa2215eb7ef0bdf30b65edda901b0e Mon Sep 17 00:00:00 2001 From: Indev Date: Fri, 8 Aug 2025 18:57:58 +0300 Subject: [PATCH] Add -strict, -strict-soc and -strict-lua cli params Both trigger I_Error if a warning occurs during addon load in a SOC or lua script --- src/dehacked.c | 3 +++ src/lua_script.c | 7 ++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/dehacked.c b/src/dehacked.c index 401ef4c9e..98d905444 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -178,6 +178,9 @@ FUNCPRINTF static void deh_warning(const char *first, ...) else CONS_Alert(CONS_WARNING, "Line %u: %s\n", dbg_line, buf); + if (dbg_line != -1 && (M_CheckParm("-strict") || M_CheckParm("-strict-soc"))) + I_Error("deh_warning: %s", buf); + deh_num_warning++; Z_Free(buf); diff --git a/src/lua_script.c b/src/lua_script.c index 2131b18c2..54e8a6868 100644 --- a/src/lua_script.c +++ b/src/lua_script.c @@ -24,6 +24,7 @@ #include "p_slopes.h" // for P_SlopeById #include "s_sound.h" #include "m_menu.h" +#include "m_argv.h" #ifdef LUA_ALLOW_BYTECODE #include "d_netfil.h" // for LUA_DumpFile #endif @@ -302,7 +303,11 @@ static inline void LUA_LoadFile(MYFILE *f, char *name) lua_pushcfunction(gL, LUA_GetErrorMessage); if (luaL_loadbuffer(gL, f->data, f->size, va("@%s",name)) || lua_pcall(gL, 0, 0, lua_gettop(gL) - 1)) { - CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL,-1)); + if (M_CheckParm("-strict") || M_CheckParm("-strict-lua")) + I_Error("Lua error: %s", lua_tostring(gL, -1)); + else + CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL,-1)); + lua_pop(gL,1); } lua_gc(gL, LUA_GCCOLLECT, 0);