[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Any thoughts on indexing ...?
- From: "Alexander Gladysh" <agladysh@...>
- Date: Wed, 9 Apr 2008 12:32:01 +0400
> >>>>> "AD" == Alex Davies <alex.mania@iinet.net.au> writes:
>
> AD> local a = (1, 2, 3)[3]
>
> it would be better to have
>
> local a = {1, 2, 3}[3] -- unexpected symbol near '[', why?
>
> ps. there is weird solution: ({ 1,2,3 })[3]
This is the feature of Lua syntax. You have to enclose table
constructor (or string literal for that matter) in braces deal with it
as with general variable.
Note that this solution has performance penalty as it allocates a new table.
Alexander.