Fix cup->cachedlevels Lua getter to return entire cachedlevels list.

This commit is contained in:
Freaky Mutant Man 2025-10-26 01:26:31 +00:00 committed by Eidolon
parent add76b17aa
commit d363c71007

View file

@ -351,13 +351,12 @@ static int cup_get(lua_State *L)
lua_pushstring(L, cup->levellist[i]); lua_pushstring(L, cup->levellist[i]);
lua_rawseti(L, -2, 1 + i); lua_rawseti(L, -2, 1 + i);
} }
//return UNIMPLEMENTED;
break; break;
case cup_cachedlevels: case cup_cachedlevels:
lua_createtable(L, ((cup->numlevels) + (cup->numbonus)), 0); lua_createtable(L, ((cup->numlevels) + (cup->numbonus)), 0);
for (size_t i = 0; i < ((cup->numlevels) + (cup->numbonus)); i++) for (size_t i = 0; i < CUPCACHE_MAX; i++)
{ {
lua_pushnumber(L, cup->cachedlevels[i]); lua_pushnumber(L, (cup->cachedlevels[i])+1);
lua_rawseti(L, -2, 1 + i); lua_rawseti(L, -2, 1 + i);
} }
break; break;