lua-users home
lua-l archive

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


On Mon, May 10, 2010 at 2:26 AM, Juris Kalnins <juris@mt.lv> wrote:
>> Could x[] be syntactic sugar for x[#x+1] ?  ...
> Actually, it would be more powerful to have [] operator take arbitrary
> number of values, just like () does.

With these extensions, "t[f()] = 1" might have different meanings
depending on whether f() returns 0, 1, or > 1 values.

The existing ways to express matrix get/set syntax in Lua [1-2] are
either less efficient or less clean than m[a,b]=c .  Even with good
syntax, questions of efficiency remain though [3].

[1] http://lua-users.org/lists/lua-l/2009-11/msg00285.html
     "help to (slightly) modify Lua interpreter"
[2] http://lua-users.org/lists/lua-l/2008-07/msg00604.html
     "How do I get two dimensional array access notation for my
(matrix) userdata?"
[3] http://lua-users.org/lists/lua-l/2009-08/msg00048.html
     "matrix operations and temporary objects?"