mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-08-11 02:43:58 +02:00
Fix off-by-one issue in sim.parts, fixes #678
This commit is contained in:
@@ -1893,11 +1893,9 @@ int PartsClosure(lua_State * l)
|
|||||||
int i = lua_tointeger(l, lua_upvalueindex(1));
|
int i = lua_tointeger(l, lua_upvalueindex(1));
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
if(i>=NPART)
|
if (++i >= NPART)
|
||||||
return 0;
|
return 0;
|
||||||
else
|
} while (!luacon_sim->parts[i].type);
|
||||||
i++;
|
|
||||||
} while(!luacon_sim->parts[i].type);
|
|
||||||
lua_pushnumber(l, i);
|
lua_pushnumber(l, i);
|
||||||
lua_replace(l, lua_upvalueindex(1));
|
lua_replace(l, lua_upvalueindex(1));
|
||||||
lua_pushnumber(l, i);
|
lua_pushnumber(l, i);
|
||||||
|
Reference in New Issue
Block a user