- Joined
- Aug 7, 2013
- Messages
- 1,342
Hi,
What is better style/practice if I want to reference a collection of variables that have the same name/form, but only differ on a parameter, e.g.
var_1
var_2
var_3
...
Would I make an array instead?
var[0] = "1"
var[1] = "2"
var[2] = "3"
and then reference the array member?
for i=0, 2 do
print(var)
or
for i=0, 2 do
print(_G["var_" .. i])
What is better style/practice if I want to reference a collection of variables that have the same name/form, but only differ on a parameter, e.g.
var_1
var_2
var_3
...
Would I make an array instead?
var[0] = "1"
var[1] = "2"
var[2] = "3"
and then reference the array member?
for i=0, 2 do
print(var)
or
for i=0, 2 do
print(_G["var_" .. i])






