Closed capthehacker99 closed 6 months ago
It seems to be related to NAMECALL as it uses table_remove which can trigger this error as shown here: https://devforum.roblox.com/t/invalid-key-to-next/223193
Removing table_remove doesn't do anything so it might be something else, but it seems to happen only with namecalling. Iterating the table directly doesn't trigger this error.
Getting the same error lol
Does the same thing occur with generalized iteration disabled?
The provided snippet, works. What settings are you using?
Default settings
The same thing occurs with generalized iteration disabled. It happens at runtime using Fiu main.
How did you get the Luau bytecode you are using?
luau-compile -O2 -g1 --binary test.lua > outbc.bc
Fiu VM Error { Name: (main) Line: 267 PC: 17 Opcode: FORGLOOP }: invalid key to 'next'
Seems like the error you commented above is a much larger script in which anything could've possibly happened. And for the sample you provided I could not get the same error you got.
No the given script is the one that causes the error, it is not part of a larger script
After experimenting modifying the script to this:
local lols = {}
function lols:get_tabs()
return {
"Foo",
"Bar",
"Alice",
"Bob"
}
end
local onext = next
next = function(a, b)
print("NEXT", unpack(a), b)
return onext(a, b)
end
for i, v in next, lols:get_tabs() do
print(v)
end
Running it with luau
it outputs this:
NEXT Foo nil
Foo
NEXT Foo 1
Bar
NEXT Foo 2
Alice
NEXT Foo 3
Bob
NEXT Foo 4
However, when compiled to bytecode and ran using Fiu it outputs this:
NEXT Foo table: 0x000001d099479588
Fiu VM Error { Name: (main) Line: 277 PC: 23 Opcode: FORGLOOP }: Fiu VM Error { Name: (??) Line: 18 PC: 14 Opcode: CALL }: invalid key to 'next'
From this I can see that Fiu makes it so that next gets called with the second argument being a table instead of being nil like vanilla luau VM which triggers the invalid key to 'next'
error.
Btw the variable fiu
from the image above is just:
local fiu = (function()
-- Fiu's Source.lua from the main branch
end)()
I tried your modified script, and running both luau and fiu seems to work just as fine, I might be missing what else could be a problem here.
I tried your modified script, and running both luau and fiu seems to work just as fine, I might be missing what else could be a problem here.
What version of fiu and luau are you running on? I clone the latest version of fiu and luau from the main branch and build it and tested it and it still have this issue.
What version of fiu and luau are you running on?
I'm using Luau v0.625, and the fiu version is the latest one from main branch. This also worked on all optimization levels.
What version of fiu and luau are you running on?
I'm using Luau v0.625, and the fiu version is the latest one from main branch. This also worked on all optimization levels.
I checkout luau v0.625 and use that, and this error still happens. You seem to be using some kind of test file, Maybe that interferes with the script somehow? I tried this on both Windows and Arch and this error persists.
@capthehacker99 We won't be working to fix any issues you make that don't provide proper reproduction steps and code, I recommend updating the Luau in your path as a first fix as all of the samples you have provided give us working results.
The luau in my path is the latest version in the main branch in the luau repo. I had no idea why you guys can't reproduce the issue cuz both me and blatant has this issue. Here is a video of me reproducing the issue: https://youtu.be/gla66qJVPkg
The luau in my path is the latest version in the main branch in the luau repo. I had no idea why you guys can't reproduce the issue cuz both me and blatant has this issue. Here is a video of me reproducing the issue: https://youtu.be/gla66qJVPkg
This is pretty odd, can you zip up the directory you did this in and send me it?
I have found something interesting, your issue with fiu works with lune
, and fiu-tests
, but does not work with Luau's own compiled binary, luau
, even if you try require("./Source.lua")
luau would error, not sure why. This might be a luau
bug?
Another thing luau for some reason in Fiu does not do any mult-ret returns after calling a function, and all returns are completely shifted, but in lune
or fiu-tests
, this doesn't seem to be a problem.
This is a Luau issue that'll get fixed in a new release soon, we couldn't reproduce it because none of the dynamic flags (specifically LuauFastCrossTableMove
in this case) are enabled in Lune and our test suite. For now I just recommend waiting, we cant do much on our side.
Additionally a Luau engineer disabled the flag in Studio so it will work there.
This script runs fine using luau:
However when compiled into bytecode and ran using fiu it will output the following error:
Fiu VM Error { Name: (main) Line: 267 PC: 17 Opcode: FORGLOOP }: invalid key to 'next'