lua-users home
lua-l archive

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

> Why does the syntax enforce numbered items before string items though? It
> seems with the syntax you present above, there would be no confusion, even
> when alternating numbered and string entries,

We think it would be confusing to allow a free mix of both "record" and
"list" styles in a table construction; for instance:

a = {'a', 'b', [4]='c', 'd'}

The element 'd' should be in index 3, 4 or 5? Moreover, this free mix would
complicate the code generation. However, we are considering in Lua 3.1 to
allow the "record" part to come before the "list" part, as in:

a = {style = "picture"; 'a', 'b', 'c'}

-- Roberto