Spawning objects

I found this - http://www.coronalabs.com/blog/2011/09/14/how-to-spawn-objects-the-right-way/ -

to learn how to spawn objects. Here is the code snippet -

–Create a table to hold our spawns
local spawnTable = {}
–Spawn two objects
for i = 1, 2 do spawnTable[i] = spawn()
end

I have never spawned objects or made a table so this is new to me. Any help is appreciated. Thank you. [import]uid: 157993 topic_id: 30664 reply_id: 330664[/import]

local spawnTable = {} That’s the way to create a table.

for i = 1, 2 do
i is a variable and ( by default ) it increments in +1 until it goes to 2.
That’s why it says: --Spawn two objects
That’s basic. You should learn something about lua programming. Just the basic :frowning:

Try to understand the commentaries in the code too… [import]uid: 116842 topic_id: 30664 reply_id: 122882[/import]

Thank you. I am actually watching the beginner dvd course. Im still on disc 1 though.^^

So with "local spawnTable = {} ",

would there ever be an instance where you would put something between the braces?
[import]uid: 157993 topic_id: 30664 reply_id: 123025[/import]

local spawnTable = {} That’s the way to create a table.

for i = 1, 2 do
i is a variable and ( by default ) it increments in +1 until it goes to 2.
That’s why it says: --Spawn two objects
That’s basic. You should learn something about lua programming. Just the basic :frowning:

Try to understand the commentaries in the code too… [import]uid: 116842 topic_id: 30664 reply_id: 122882[/import]

Thank you. I am actually watching the beginner dvd course. Im still on disc 1 though.^^

So with "local spawnTable = {} ",

would there ever be an instance where you would put something between the braces?
[import]uid: 157993 topic_id: 30664 reply_id: 123025[/import]