lua-users home
lua-l archive

Re: variable names from variables?

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


On 02/02/2011 09:40 AM, Leo Razoumov wrote:
On Wed, Feb 2, 2011 at 09:07, Patrick Mc(avery>
I wanted to generate a bunch of "free standing tables within a namespace but
not nested in another table. Each table would be a manufacturers part number
and would start with letters and end with numbers, i.e WOT2930, hence the
concatenation.
Is there a good reason why not make them all elements of a table?
Table approach is simple, readable and flexible. For example, you can
make your table read-only so that nobody can change the part number
WOT2930 after it is set. With local variables you still can by mistake
reset the value to something wrong or nil.
--Leo--
Thanks Leo, Thanks again Robby
If there is not a simple way to do this I better not, there's no way I am going to come up with a better idea then you guys, I'll just stick to regular Lua idioms for now, i.e tables in tables.
Have a great day-Patrick

AltStyle によって変換されたページ (->オリジナル) /