Hi folks,
I’m trying to insert display objects to a table.
If I have ‘objNum = 3’ , I want to insert 3 display objects into the table from a list.
For example: (What I’m working with so far - Although wrong)
local listElements = {} local objNum = 3 for elementPopulate = 1, objNum, 1 do table.insert(listElements, display.newImageRect("Images/Object1.png",512,128)) table.insert(listElements, display.newImageRect("Images/Object2.png",512,128)) table.insert(listElements, display.newImageRect("Images/Object3.png",512,128)) end
Now obviously this for loop with iterate 3 times (objNum) and I’ll actually get 9 objects (3 repeated)
But It’s very similar to what I want.
Instead, I want to only add that number of objects.
So:
if objNum is 2, insert the 1st & 2nd.
If objNum is 3, insert the 1st, 2nd & 3rd. etc.
Hope that’s clear. 
How would I do this?
Thanks in advance.