[SOLVED] multiple object generation

I have made a table to generate objects when a man reaches a certain x coordinate, however the table generates the same object multiple times in the same place. Is there a way of making it only generate the object once? This is the code:

[code]local rampshape = { 941, 337 , 938, 346 , -941, -338 , -938, -347 }
local ramp = {}

local function MakeBottom()
mx = man.x
for r = 1,9999 do
if man.x > (r*1879) - 3000 then
ramp[r] = display.newImage(“ramp.png”)
ramp[r]:setReferencePoint(display.TopLeftReferencePoint)
physics.addBody(ramp[r], “static”, {friction=0.01, density = 1, bounce = 0.1, shape=rampshape})
ramp[r].x = ((r*1879) - 1879)
ramp[r].y = ((r*684) - 684) + 200
ramp[r].material = “ground”
moveGroup:insert(ramp[r])
if r > 2 then
ramp[r-1]:removeSelf()
ramp[r-1] = nil
end
end
end
end
MakeBottom()
timer.performWithDelay(2000, MakeBottom, 0)[/code] [import]uid: 116264 topic_id: 24395 reply_id: 324395[/import]