I want to put pieces in an array.
For now, I do like this:
Code: Select all
local pieces = {}
local wall1 = piece "wall1" table.insert (pieces, wall1)
local wall2 = piece "wall2" table.insert (pieces, wall2)
local wall3 = piece "wall3" table.insert (pieces, wall3)
local wall4 = piece "wall4" table.insert (pieces, wall4)
local wall5 = piece "wall5" table.insert (pieces, wall5)
local wall6 = piece "wall6" table.insert (pieces, wall6)
local wall7 = piece "wall7" table.insert (pieces, wall7)
local wall8 = piece "wall8" table.insert (pieces, wall8)
local wall9 = piece "wall9" table.insert (pieces, wall9)
...
As the pieces are all named wall1 to wallover9000 i want to make the pieces table with a loop:
Code: Select all
function get_pieces()
for i=1,28 do
local pname = "wall" .. i
Spring.Echo ("adding piece: " .. pname)
pieces[i] = {}
pieces[i] = piece pname <- what goes here?
end
end
pieces = piece [[pname]]
and some other things but none work. I can only guess what would be correct synthax if it is even possible?
/e
got it

track = piece (pname)
great, now i am late.