From 3b14531dc2d56b7a8d38ff3fccdada71f018b67d Mon Sep 17 00:00:00 2001 From: LJ Sonic Date: Sun, 26 May 2024 17:51:20 +0200 Subject: [PATCH 1/2] Fix spriteinfo indexing --- src/lua_infolib.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/lua_infolib.c b/src/lua_infolib.c index eeb1067a3..67b9fb82d 100644 --- a/src/lua_infolib.c +++ b/src/lua_infolib.c @@ -242,17 +242,12 @@ static int lib_getSpriteInfo(lua_State *L) UINT32 i = NUMSPRITES; lua_remove(L, 1); - if (lua_isstring(L, 1)) + if (lua_type(L, 1) == LUA_TSTRING) { const char *name = lua_tostring(L, 1); INT32 spr = R_GetSpriteNumByName(name); if (spr == NUMSPRITES) - { - char *check; - i = strtol(name, &check, 10); - if (check == name || *check != '\0') - return luaL_error(L, "unknown sprite name %s", name); - } + return luaL_error(L, "unknown sprite name %s", name); i = spr; } else From 1ba9ecf02794e3acfd8def53ef5dd219b1e173eb Mon Sep 17 00:00:00 2001 From: LJ Sonic Date: Sun, 26 May 2024 17:51:48 +0200 Subject: [PATCH 2/2] Add missing newline in console warning --- src/lua_infolib.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lua_infolib.c b/src/lua_infolib.c index 67b9fb82d..511c20031 100644 --- a/src/lua_infolib.c +++ b/src/lua_infolib.c @@ -1735,7 +1735,7 @@ static int lib_setSkinColor(lua_State *L) else if (i == 6 || (str && fastcmp(str,"accessible"))) { boolean v = lua_toboolean(L, 3); if (cnum < FIRSTSUPERCOLOR && v != skincolors[cnum].accessible) - CONS_Alert(CONS_WARNING, "skincolors[] index %d is a standard color; accessibility changes are prohibited.", cnum); + CONS_Alert(CONS_WARNING, "skincolors[] index %d is a standard color; accessibility changes are prohibited.\n", cnum); else info->accessible = v; } @@ -1830,7 +1830,7 @@ static int skincolor_set(lua_State *L) else if (fastcmp(field,"accessible")) { boolean v = lua_toboolean(L, 3); if (cnum < FIRSTSUPERCOLOR && v != skincolors[cnum].accessible) - CONS_Alert(CONS_WARNING, "skincolors[] index %d is a standard color; accessibility changes are prohibited.", cnum); + CONS_Alert(CONS_WARNING, "skincolors[] index %d is a standard color; accessibility changes are prohibited.\n", cnum); else info->accessible = v; } else