lua-users home
lua-l archive

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


On Wednesday 09 March 2011 02:54:50 Pierre-Yves Gérardy wrote:
> On Wed, Mar 9, 2011 at 08:48, Alan Zheng <machinecat1666@gmail.com> wrote:
> > I get the error message "stdin:1: '<name>' expected near 'end'", others
> > index name (for example, a.end1=2, a.b=2 ) are ok.
> > Looks like only "end" given error message.
> 
> 'end' is a lua keyword. You'd get the same error with 'if', 'for', 'do',
> and so on. In these cases, you can't use the 'tbl.key' syntax, you have to
> use 'tbl["key"]' instead.

This is the first surprising behavior I've ever seen in Lua. I would have 
expected it to know that mytable.end is a table element whose name happens to 
be "end".

SteveT

Steve Litt
Recession Relief Package
http://www.recession-relief.US
Twitter: http://www.twitter.com/stevelitt