[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Lua 5.2 Length Operator and tables (bug?)
- From: chris <csrl@...>
- Date: Tue, 17 Apr 2012 01:05:59 +0000 (UTC)
Matthew Wild <mwild1 <at> gmail.com> writes:
> Attempting to define explicitly undefined behaviour is just not a good
> idea. It will easily lead you down the road of portability and
> compatibility problems.
Could someone state what the *defined* behavior is?
The best I can come up with is:
The length operator, when used on a table, will only provide the length of the
table, if and only if, the table's only positive numeric indices's are a
sequence of {1..n}. Non numeric indices's may also exist. The existence of any
other numeric indices's invalidate the result of the length operator. As such
you must know before hand whether or not a table conforms to these constraints
in order to make valid use of the length operator on a table.
Can anyone add to or improve upon that?
Thanks,
chris