lua-users home
lua-l archive

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


David Given wrote:
The . syntax for tables is semantic sugar for using a string key, so
table.four and table["four"] are equivalent --- but in this case, the thing
after the . must be a valid keyword, and there are strict rules about that.

For the record, you had a poor choice of word here... ;-)
"The thing after the . must be a valid identifier which must not be a keyword" would have been better...

foo.doh is valid;
foo.for isn't.

And although legal, using 'table' as a table name, although tempting, even more for small demonstration snippet, is not a good idea, as you probably will mask the 'table' table from the standard library.

I just write that so some newbies reading this thread won't fall in some pitfalls! :-D

--
Philippe Lhoste
--  (near) Paris -- France
--  http://Phi.Lho.free.fr
--  --  --  --  --  --  --  --  --  --  --  --  --  --