Fix implementation of foreach

Oritinal foreach can correctly traverse the table even when the called
function removes the element. Make it in-line with vanilla pico8

Fixe level skipping in celeste classic
This commit is contained in:
Vladimir Serbinenko 2022-02-28 13:39:41 +01:00
parent e5eb738341
commit 407c53122b
2 changed files with 2 additions and 2 deletions

View File

@ -24,7 +24,7 @@ end
function foreach(c, f)
if c ~= nil then
for key, value in ipairs(c) do
for value in all(c) do
f(value)
end
end

View File

@ -25,7 +25,7 @@ const char* lua_api_string =
"\n"
"function foreach(c, f)\n"
" if c ~= nil then\n"
" for key, value in ipairs(c) do\n"
" for value in all(c) do\n"
" f(value)\n"
" end\n"
" end\n"