for i = 1,100 do
local object = factory.create("#factory")
timer.delay(math.random(1,3), false, function() go.delete(object) end)
end
How can I save an instance of the created object so I can delete it after a moment?
ERROR:SCRIPT: /mob/ai/ai_callbacks.lua:60: Instance (null) not found
stack traceback:
[C]: in function 'delete'
/mob/ai/ai_callbacks.lua:60: in function </mob/ai/ai_callbacks.lua:60>
Should I create a table containing all the created objects or is there a way to pass the exact instance that is created in the current iteration to the timer callback?