lua-users home
lua-l archive

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


I'm for "a.2". always wondered why that was not allowed.

On Fri, Jul 1, 2016 at 9:30 PM, Martin <eden_martin_fuhrspam@gmx.de> wrote:

On 16-06-30 05:11 PM, Tim Hill wrote:
>> What about {1, [3]=3, 2} ? {1, [2]=2, 2} ? etc
>>
>
> 2 and 2. The largest implicit key. As I said, this is the *least* surprising, not that it has no surprises at all.

Huh. And what length of sequence should be after

local t = {1, [2]=2, 2}
table.remove(t, 2)
--print(t[2])
?

I think, better approach is to explicitly separate array part from hash
part. But then we need separate indexing method for array part. Maybe
syntax like "a.2" ?