lua-users home
lua-l archive

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


Recently I stumbled upon that `print({}[1])` fails to parse with "')'
expected near '['". However `print(({})[1])` parses without problem.

I checked Lua's grammar and found out that this is the expected
behavior and not a bug in Lua's parser.

Is there a reason for this? Would allowing expressions like
`{foo}[bar]` overcomplicate Lua's grammar and parsing?

Kind regards,

Slavomir Kaslev