lua-users home
lua-l archive

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


Hallo,

2010/5/24 spir ☣ <denis.spir@gmail.com>:
> Hello,
>
>
> A correspondant on another list posted the following:
>
> =================
> I like some of the features of lua and php tables, but there are some really odd spots:
>
>> t = {1, 2, [1]=3}
>> return  t[1]
> 1
>> t = {[1]=1, 2}
>> return  t[1]
> 2
>
> ...
> =================
>
> Same behaviour by me (Lua 5.1.4). The only interpretation I can think at turns around array part optimization. Just a wild guess:

     It's not about optimisation. In the table constructor, key-less
values are given integer autoincrementing keys, that's all.

Cheers,
-- 
-alex
http://www.ventonegro.org/