From 2019e7df18f1b912b66136f6bcccb65f86e33686 Mon Sep 17 00:00:00 2001 From: Lactozilla <jp6781615@gmail.com> Date: Tue, 16 Jan 2024 20:17:01 -0300 Subject: [PATCH] Throw warning on invalid translations --- src/lua_mobjlib.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/lua_mobjlib.c b/src/lua_mobjlib.c index 301a9cfd2c..85e4590c57 100644 --- a/src/lua_mobjlib.c +++ b/src/lua_mobjlib.c @@ -710,9 +710,14 @@ static int mobj_set(lua_State *L) } case mobj_translation: { - int id = R_FindCustomTranslation(luaL_checkstring(L, 3)); - if (id != -1) - mo->translation = id; + if (!lua_isnil(L, 3)) { + const char *tr = luaL_checkstring(L, 3); + int id = R_FindCustomTranslation(tr); + if (id != -1) + mo->translation = id; + else + return luaL_error(L, "invalid translation '%s'.", tr); + } else mo->translation = 0; break; -- GitLab