lua-users home
lua-l archive

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


>From lua-l@tecgraf.puc-rio.br Mon Aug 30 14:15:32 1999
>From: David Jeske <jeske@chat.net>

>As I've mentioned in the past, I only wanted the freedom to put the
>numeric values at the beginning _or_ the end. I don't know if the
>current Lua can do this, I think someone said it would be able to. For
>example:
>
> t = { 42, 52 ; name = "bob", color = "blue" }  
> t = { name = "bob", color = "blue" ; 42, 52 }  -- either one works

Yes, this works since 3.1.
You can write the 'list' part before the 'record' part, or vice-versa.
But you cannot mix the two.

Like Roberto said, one reason is that it would make the implementation too
complicated, for little benefit, since we think that the current syntax covers
most cases nicely (and efficiently).

The argument that it was hard to output tables in Lua was handled in 3.0,
when we added the {[exp] = exp, ... } syntax.
--lhf