lua-users home
lua-l archive

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


Well my lua fu isn't the strongest but if your worried about keys conflicting with reserved words, I would think as long as they don't start with '__' that you would be good. Even then I think thats just metatables. As for the root tables, I would just use a fake name space naming convention such as Foo_MyTable.

Leigh

----- Original Message ----- From: "Richter, Jörg" <Joerg.Richter@pdv-FS.de>
To: <lua@bazar2.conectiva.com.br>
Sent: Tuesday, February 06, 2007 8:46 AM
Subject: persistence, table constructors and reserved words


I'm saving some configuration data as a LUA script to a file, just like the serialization example in PiL.

When writing string table keys I want to use the syntax { name="value" } and not { ["name"] = "value" }, to make it more readable and easier to edit by hand. Yes, you have to check <name> for valid identifiers and reserved words.

But now the problem. What if I want to read this configuration file with the next LUA version? I can only check the now known reserved words. I can add some words that are likely reserved words in the next version, like "continue" or so. Are there any other possibilities except to not use the shorthand syntax?

When not, what are likely reserved words in the next version?


I think the best solution would be to allow reserved words in table constructors.


  Jörg