Originally Posted by ballagarba
Hmm, correct me if I'm wrong but couldn't you just imitate the _G with a local version, since as far as I understand, _G is just a table.
|
Effectively that's what I've done in my workaround (just different variable names), seems you got that idea faster than I did
Originally Posted by suicidalkatt
I think what you're trying to say, is there a different way of getting the global variable without using this?
In the usage you're describing, no.
|
No, I was looking for a way to get a local variable, similar to how you use _G to get a global variable.
Originally Posted by SDPhantom
As for a true Lua global, there's no way to define or read dynamic locals. However as you've demonstrated, you may define a single local table that holds additional data as key/value pairs. I would advise against this unless absolutely necessary as table entries consume more resources than locals themselves. I follow the simple rule, tables are only for list/structure data, everything else is to stay in locals.
|
So, it'd be faster and more efficient to hardcode everything that needs to be done for each local, instead of putting them into a table and iterating over it?