mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-21 20:11:12 +00:00
Fix spriteinfo indexing
This commit is contained in:
parent
a75fbd229e
commit
3b14531dc2
1 changed files with 2 additions and 7 deletions
|
@ -242,17 +242,12 @@ static int lib_getSpriteInfo(lua_State *L)
|
||||||
UINT32 i = NUMSPRITES;
|
UINT32 i = NUMSPRITES;
|
||||||
lua_remove(L, 1);
|
lua_remove(L, 1);
|
||||||
|
|
||||||
if (lua_isstring(L, 1))
|
if (lua_type(L, 1) == LUA_TSTRING)
|
||||||
{
|
{
|
||||||
const char *name = lua_tostring(L, 1);
|
const char *name = lua_tostring(L, 1);
|
||||||
INT32 spr = R_GetSpriteNumByName(name);
|
INT32 spr = R_GetSpriteNumByName(name);
|
||||||
if (spr == NUMSPRITES)
|
if (spr == NUMSPRITES)
|
||||||
{
|
return luaL_error(L, "unknown sprite name %s", name);
|
||||||
char *check;
|
|
||||||
i = strtol(name, &check, 10);
|
|
||||||
if (check == name || *check != '\0')
|
|
||||||
return luaL_error(L, "unknown sprite name %s", name);
|
|
||||||
}
|
|
||||||
i = spr;
|
i = spr;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue