[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Question about # operator in LuaJIT
- From: Gianmaria Bajo <mg1979.git@...>
- Date: Mon, 27 Feb 2023 06:14:05 +0100
I found some discrepancies between LuaJIT (2.1.0-beta3) and Lua 5.1.5 regarding the length (#) operator that I cannot understand.
Consider:
local a = {1, nil, nil, 2, nil, 3, nil, 4}
print(#a)
In both LuaJIT and Lua 5.1.5 the result is 8 (as expected).
This instead:
local a = {1, nil, 2, nil, 3, nil, 4}
print(#a)
Lua 5.1.5 gives 7 as result, LuaJIT gives 1. Is there a logic I cannot see?
Thanks