Whats the best way to perform an action periodically? (SOLVED)

Something like this:

local function timer_callback(self, handle, time_elapsed)
	print("time_elapsed: " , time_elapsed)
	-- Cancel anytime with:  
	-- timer.cancel(self.timer_handle ) 
	-- or
	-- timer.cancel(handle) 
end
function init(self)
        -- timer.delay(delay, repeat, callback)
	self.timer_handle =  timer.delay(3, true, timer_callback)
end
1 Like