Changeset

4385:c94167139f27

util.timer: Fix corner case of timer not repeating if it returns <= 0
author Matthew Wild <mwild1@gmail.com>
date Thu, 22 Sep 2011 15:48:56 +0100
parents 4384:7fbcb7e6a6a0
children 4386:ce769240f8ec
files util/timer.lua
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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