Execute a function on a repeating timer (SOLVED)

This variant will be better if user need to cancel timers by callback (your variant create timer after callback, and timer continue working):

function M.repeat_seconds(seconds, callback)
	M.seconds(seconds, function()
		M.repeat_seconds(seconds, callback)
		callback() -- callback call after create a new repeat
	end)
end
2 Likes