Here is the code:
array1 = {}
array2 = {
value1 = "",
value2 = "",
value3 = ""
}
for a=1,10 do
array1[a] = array2
array1[a].value1 = a
end
for a=1,10 do
print(array1[a].value1)
end
The goal is to create one table inside another table (array2 inside array1) then set a value in the second table (value1 of array2 in this example) to individual values (a in this example).
When I run the program there are no errors but it says the value for each of array1[1-10].value1 are all equal to 10 when array1[1].value1 should be equal to 1, array1[2].value1 should be equal to 2, etc…
Thanks in advance for the help.
Jason [import]uid: 142486 topic_id: 26847 reply_id: 326847[/import]
