Fix spriteinfo indexing

This commit is contained in:
LJ Sonic 2024-05-26 17:51:20 +02:00
parent a75fbd229e
commit 3b14531dc2

View file

@ -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);
}
i = spr;
}
else