Fix game crashing when attempting to print '%s has no field named %s' for few lua userdata objects

This commit is contained in:
indev committed 2025-05-12 18:02:20 +03:00
1 parent 740de2babe
commit 8abab58a5c
4 files changed
+7 -7

No files matched your search

+1 -1
View File
@@ -629,7 +629,7 @@ static int cvar_get(lua_State *L)
break;
default:
if (devparm)
return luaL_error(L, LUA_QL("consvar_t") " has no field named " LUA_QS, field);
return luaL_error(L, LUA_QL("consvar_t") " has no field named " LUA_QS, lua_tostring(L, 2));
else
return 0;
}
+2 -2
View File
@@ -385,7 +385,7 @@ static int state_get(lua_State *L)
default:
{
if (devparm)
return luaL_error(L, LUA_QL("state_t") " has no field named " LUA_QS, field);
return luaL_error(L, LUA_QL("state_t") " has no field named " LUA_QS, lua_tostring(L, 2));
return 0;
}
}
@@ -462,7 +462,7 @@ static int state_set(lua_State *L)
break;
default:
return luaL_error(L, LUA_QL("state_t") " has no field named " LUA_QS, field);
return luaL_error(L, LUA_QL("state_t") " has no field named " LUA_QS, lua_tostring(L, 2));
}
return 0;
+2 -2
View File
@@ -877,7 +877,7 @@ static int mapthing_get(lua_State *L)
break;
default:
if (devparm)
return luaL_error(L, LUA_QL("mapthing_t") " has no field named " LUA_QS, field);
return luaL_error(L, LUA_QL("mapthing_t") " has no field named " LUA_QS, lua_tostring(L, 2));
else
return 0;
}
@@ -931,7 +931,7 @@ static int mapthing_set(lua_State *L)
mt->mobj = *((mobj_t **)luaL_checkudata(L, 3, META_MOBJ));
break;
default:
return luaL_error(L, LUA_QL("mapthing_t") " has no field named " LUA_QS, field);
return luaL_error(L, LUA_QL("mapthing_t") " has no field named " LUA_QS, lua_tostring(L, 2));
}
return 0;
+2 -2
View File
@@ -707,8 +707,8 @@ static int kartstuff_len(lua_State *L)
return 1;
}
#define NOFIELD luaL_error(L, LUA_QL("ticcmd_t") " has no field named " LUA_QS, field)
#define NOSET luaL_error(L, LUA_QL("ticcmd_t") " field " LUA_QS " should not be set directly.", field)
#define NOFIELD luaL_error(L, LUA_QL("ticcmd_t") " has no field named " LUA_QS, lua_tostring(L, 2))
#define NOSET luaL_error(L, LUA_QL("ticcmd_t") " field " LUA_QS " should not be set directly.", lua_tostring(L, 2))
enum ticcmd_e
{