As parameters you can pass a function to execute, the time interval in milliseconds, and the number of times to repeat the function (including infinitely).
local loopy = { i=1, k=1, timer = function(self,event) print("i k =",self.i,self.k) self.k=self.k+1 if (self.k\>5) then self.i,self.k = self.i+1,1 if (self.i\>10) then timer.cancel(event.source) end end end } timer.performWithDelay(1000,loopy,-1)
As parameters you can pass a function to execute, the time interval in milliseconds, and the number of times to repeat the function (including infinitely).
local loopy = { i=1, k=1, timer = function(self,event) print("i k =",self.i,self.k) self.k=self.k+1 if (self.k\>5) then self.i,self.k = self.i+1,1 if (self.i\>10) then timer.cancel(event.source) end end end } timer.performWithDelay(1000,loopy,-1)