Hello Community,
I’m developing a game that involves pausing ang resuming timers. I think, and I hope it is not, there’s a bug in resuming timer. Here’s a substitute of my game. It is simple but why is it not showing the number I’m expecting?
[lua]local function timerExercise()
local timers = {}
for counter = 1, 50 do
timers[counter] = timer.performWithDelay( 2000 + (counter * 1000), function ()
print (“Timer #”…counter)
if counter == 5 then
for countme = counter + 1, #timers do
if timers[countme] ~= nil then
print (“PAUSE! #”…countme…" - "…timer.pause(timers[countme]))
end
end
timer.performWithDelay(5000, function()
for countme = counter+1, #timers do
timer.resume(timers[countme])
end
end)
end
end)
end
end
timerExercise()[/lua]
what i’m expecting as a result is printing first 6…7…8…9 and so on. What it is displaying is 6-11 together then 7-12…13-18… why is this? this timer is very crucial for my game. Please Help. [import]uid: 141531 topic_id: 26087 reply_id: 326087[/import]
[import]uid: 52491 topic_id: 26087 reply_id: 105811[/import]