[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Lua 5.2 Length Operator and tables (bug?)
- From: Matthew Wild <mwild1@...>
- Date: Mon, 16 Apr 2012 12:18:41 +0100
On 16 April 2012 11:35, Jose Torre-Bueno <jtorrebueno@cox.net> wrote:
>
> Is there any way other than probing as Carl did to find out how Lua has organized a table or even to predict what ipairs will do?
>
> Perhaps the message is dont ask because the parser is free to reorganize a table whenever it wants which suggests that # has very limited usefulness. It seems that if a table has valid elements from index 1 to n # will return n but the reverse is not true so # cannot be used to learn if a table includes a fully populated array.
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.
Regards,
Matthew