lua-users home
lua-l archive

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


It was thus said that the Great SH once stated:

> > When I see { function..., function... } my natural inclination is to see
> > those as array items 1 and 2, which they would be in the current syntax.
> 
> Why? This does not resolve to a value. So why would it be assigned to [1]
> and [2] ? You cannot simply ignore the provided names.
> I don't see any ambiguity here.

  The following does work:

  x = { function(a) return a + 1 end , function(a) return a - 1 end }

  y = x[1](1) print(y)
  y = x[2](1) print(y)

  -spc