lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Tue, 27 Oct 2020, 19:27 Grzegorz Krasoń, <grzegorz.krason@gmail.com> wrote:
How to understand the difference between t1 and t2 in the example below? They give the same results while iterating, but `#` returns different values. Is this expected?

Yes, it is expected. See the definition of the length operator in the manual: https://www.lua.org/manual/5.4/manual.html#3.4.7

Specifically, your example tables are not sequences and the length operator may return one of multiple possible values for such a table.

Regards,
Matthew