Closed 9382 closed 2 months ago
If you're looking for a version to match the original lua implementation, here's a fixed version with as little change as possible to the original function
local function TableUnpack(tbl, i, j)
i = i or 1
j = j or #tbl
if j-i+1 >= 10 then
return tbl[i], tbl[i + 1], tbl[i + 2], tbl[i + 3], tbl[i + 4],
tbl[i + 5], tbl[i + 6], tbl[i + 7], tbl[i + 8], tbl[i + 9],
TableUnpack(tbl, i + 10, j)
end
if i <= j then return tbl[i], TableUnpack(tbl, i + 1, j) end
end
Normal lua unpack takes an
i
and aj
arg, which are a starting and finishing position. The custom implementation added in eb5aba74424255fc61558f57c63d7fb2e411bf27 takes a starting positioni
and a countremaining
, which is slightly different. Either certain code (the executor part) needs to use the original unpack or needs to be adjusted for the new unpack or the new implementation needs to follow the original lua implementation (a short look at temp3 on a basic script pops upOpReturn
andOpCall
at the very least that use TableUnpack)Example failing script:
This will print
1, 2, 3
every time under the VM