lua-users home
lua-l archive

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


>> Because it's ambiguous?
> Actually it isn't.

>From the language grammar point of view, it is ambiguous.
But from the programmer point of view, it is.
I think most people would expect t.1 == t[1], but the parser would
assume t.1 == t["1"].
The dot syntax is a syntax sugar to have named fields in a table.
And I can't find a real world situation were t.1 (meaning t["1"])
could be useful. You can still use t.f1, t._1, ... if you want.