How do I go about create variable names out of dynamic elements?
Say I wanted to create 10 vars:
myVar_0 - myVar_9
Using a for loop how would I write this please?
Thanks in advance.
Variable creation
Moderators: Shine, Insert_witty_name
it would proably be best to use a table for that
im sure theres another way to do that but thats the only one i can thing of right now
Code: Select all
mayVar_ = {}
for i=1, 10 do
myVar_[i-1] = ""
end
-
- Posts: 31
- Joined: Sat Mar 04, 2006 1:35 am
I don't think your can index an element at 0. It has to start at 1.JorDy wrote:it would proably be best to use a table for thatim sure theres another way to do that but thats the only one i can thing of right nowCode: Select all
mayVar_ = {} for i=1, 10 do myVar_[i-1] = "" end