Hi all,
Assume I have 30 tables inside a table called tbl_Items, and 5 parts inside each Item table, something like:
tbl_Items = {}
Table.Insert (tbl_Items, 1, tbl_Item1)
Table.Insert (tbl_Items, 2, tbl_Item2)
Table.Insert (tbl_Items, 3, tbl_Item3)
…and so on up to 30.
Table.Insert (tbl_Item1, 1, Part#1)
Table.Insert (tbl_Item1, 2, Part#2)
Table.Insert (tbl_Item1, 3, Part#3)
…and so on up to 5 for each one of the 30 item tables.
Is there any way to fulfil the tables with few lines (see code below) or as I’m afraid, should I code each single line of code?
for i = 1, 30 do
Table.Insert (tbl_Items, i , “tbl_Item”..i)
for j = 1, 5 do
Table.Insert(“tbl_Item”..i, j, Part#”..j)
end
end
The above code does not work, I guess a constraint of how lua deal with tables.
Any idea or workaround?