Skip to content

Instantly share code, notes, and snippets.

@akshada-systematix
Created March 13, 2015 12:21
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save akshada-systematix/704aa2224c009115c17c to your computer and use it in GitHub Desktop.
Save akshada-systematix/704aa2224c009115c17c to your computer and use it in GitHub Desktop.
Infinite Timer Loop to make function calls at different interval of time
--Infinite timer with different time interval
--Initialize timers
local timer_1, timer_2, timer_3
function A()
print(“This is function A”)
if (timer_1) then
timer.cancel(timer_1) --cancelling 'timer_1' if exist
end
if (timer_3) then
timer.cancel(timer_3) --cancelling 'timer_3' if exist
end
timer_2 = timer.performWithDelay(500, B, 1)
end
function B()
print(“This is function B”)
if (timer_2) then
timer.cancel(timer_2) --cancelling 'timer_2' if exist
end
timer_3 = timer.performWithDelay(100, A, 1)
end
timer_1 = timer.performWithDelay(100, A, 1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment