Throw warning on invalid translations

This commit is contained in:
Lactozilla 2024-01-16 20:17:01 -03:00
parent b6e4771085
commit 2019e7df18

View file

@ -710,9 +710,14 @@ static int mobj_set(lua_State *L)
} }
case mobj_translation: case mobj_translation:
{ {
int id = R_FindCustomTranslation(luaL_checkstring(L, 3)); if (!lua_isnil(L, 3)) {
const char *tr = luaL_checkstring(L, 3);
int id = R_FindCustomTranslation(tr);
if (id != -1) if (id != -1)
mo->translation = id; mo->translation = id;
else
return luaL_error(L, "invalid translation '%s'.", tr);
}
else else
mo->translation = 0; mo->translation = 0;
break; break;