From e804bd95ffdf426bd8f4322446bf5a5be763e271 Mon Sep 17 00:00:00 2001 From: Indev Date: Sun, 16 Jul 2023 14:50:14 +0300 Subject: [PATCH] Bring back error throw in cases where mobj is altered in hud or cmd hooks --- src/lua_mobjlib.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/lua_mobjlib.c b/src/lua_mobjlib.c index cb8e0fcb0..34471bc75 100644 --- a/src/lua_mobjlib.c +++ b/src/lua_mobjlib.c @@ -602,9 +602,14 @@ static int mobj_set(lua_State *L) lua_settop(L, 3); - if (!mo) { + if (!mo) return LUA_ErrInvalid(L, "mobj_t"); - } + + if (hud_running) + return luaL_error(L, "Do not alter mobj_t in HUD rendering code!"); + + if (hook_cmd_running) + return luaL_error(L, "Do not alter mobj_t in BuildCMD code!"); lua_getmetatable(L, 1); // Push metatable