# HG changeset patch # User Matthew Wild # Date 1316702936 -3600 # Node ID c94167139f271048c69a0f55dc40b1182bb5e63f # Parent 7fbcb7e6a6a010ce3c619a1b207ad313d88ea1bc util.timer: Fix corner case of timer not repeating if it returns <= 0 diff -r 7fbcb7e6a6a0 -r c94167139f27 util/timer.lua --- a/util/timer.lua Tue Sep 20 23:30:58 2011 +0100 +++ b/util/timer.lua Thu Sep 22 15:48:56 2011 +0100 @@ -32,7 +32,10 @@ if delay >= current_time then t_insert(new_data, {delay, func}); else - func(); + local r = func(); + if r and type(r) == "number" then + return _add_task(r, func); + end end end