lua-users home
lua-l archive

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


Hi Patrick,

I've been trying for several days to figure out the disadvantage of having
these names be keys in a table instead of free standing local variables, and I
can't think of a reason. What is the disadvantage of having them as keys in a
table?

Here are some of the name as key advantages I see:

* You can iterate, search and total them
* You can incorporate functions applying to the set of customers into the
table.
* Your source code is more compact

Anyway, I'd like to hear the advantage of name-as-local-var.

Thanks

SteveT

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




Hi Steve

I doubt that there is much advantage to the freestanding-variable over the variable-as-key in Lua in most cases but I was thinking that if someone was writing a constructor function it might be nice for that function to be able to programatically generate variable names.

If I can find time over the next few days I am going to build a small prototype Lua web application and then hopefully later a bigger one.

I can send the code to you, I would love your feedback.

Were getting almost a foot of snow today :(, must be nice to be in Orlando! -Pat