How to delay in a loop ?

I want to use timer.performWithDelay in a loop but it doesn’t work here is the code:

local function here(i) print("here" .. tostring(i)) end for i = 1,10,1 do timer.performWithDelay(3000, here(i)) end

You should find this post helpful: https://coronalabs.com/blog/2019/04/10/using-functions-for-oncomplete-listeners/

Rob

If all you need is to pass the loop count to the function every 3 seconds for 10 times, this would work too:

[lua]

timer.performWithDelay(3000, function(e) return here(e.count) end, 10)

[/lua]

Dave

Thank you very much. 

You should find this post helpful: https://coronalabs.com/blog/2019/04/10/using-functions-for-oncomplete-listeners/

Rob

If all you need is to pass the loop count to the function every 3 seconds for 10 times, this would work too:

[lua]

timer.performWithDelay(3000, function(e) return here(e.count) end, 10)

[/lua]

Dave

Thank you very much.