lua-users home
lua-l archive

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



On Thu, Apr 05, 2012 at 17:13+0100 rjek@rjek.com wrote:
Unfortunately it is not possible to make a solution by syntactic sugar as the syntax t{_,_} already translates to t({_,_}). 
> 
> It also limits the use: what if you wanted to pass one or more tables to
> the handler?
> 
> ie, t[{1, 2}, {3, 4}]
How about: t[{{1, 2}, {3, 4}}]

I actually can't think of a place where you can't store a list into the array part of a table with one exeption: A list with variable size that contains nils (as the array length of a table is defined by the first nil). Actually this problem can also be solved by storing the number of elements somewhere in the table e.g. t[0] = number of elements.

--
Thomas