Wrong value from luaH_getn
unkernet opened this issue · comments
unkernet commented
There is difference between fengari and Lua 5.3:
local t = {1, nil, 3, 4}
print(#t) -- 1 (4 in Lua 5.3)
local t = {nil, nil, 3, 4, 5, 6, 7, 8}
print(#t) -- 6 Why?
According to the Lua 5.3 documentation
When t is not a sequence, #t can return any of its borders.
Benoit Giannangeli commented
Fengari's implementation of the table is different from PUC Rio, but I think both results are valid under the manual's definition.
daurnimator commented
local t = {nil, nil, 3, 4, 5, 6, 7, 8} print(#t) -- 6 Why?
That's a bug. It should be 0
or 8
.
daurnimator commented
Please review the fix in #163
unkernet commented
Looks good