----------------------------- -- Levak ©2014 -------------- -- http://levak.free.fr/ ---- -- levak92@gmail.com -------- ----------------------------- ---------- AnimIt : Timer extension local tstart = timer.start function timer.start(ms) if not timer.isRunning then tstart(ms) end timer.isRunning = true end local tstop = timer.stop function timer.stop() timer.isRunning = false tstop() end timer.tasks = {} function timer.addTask(object, queueID, task) table.insert(timer.tasks, {object, task, queueID}) end function timer.purgeTasks(object, queueID, complete) local j = 1 while j <= #timer.tasks do if timer.tasks[j][1] == object and (not queueID or timer.tasks[j][3] == queueID) then timer.tasks[j][2](complete) table.remove(timer.tasks, j) else j = j + 1 end end end