I would do this by storing the time that the original timer started and then calculating the other timers around that, i.e.
local maxTime = 21020 local timers = {} local startTime = system.getTimer() timers[1] = timer.performWithDelay( maxTime, destroy ) -- some time later when you create a new timer timers[2] = timer.performWithDelay( maxTime-(system.getTimer()-startTime), destroy )
(system.getTimer()-startTime) simply gives you the amount of time that has passed since the startTime was taken, i.e. when timers[1] was fired. When you then subtract this time from the maxTime that you gave the initial function, they’ll stop at the same time.
If you use the method above, you could write a safety function that first checks if maxTime-(system.getTimer()-startTime) is actually positive and if it its, then creates a new timer. I haven’t yet tried what happens if you try to create a timer with negative time. 