util.timer: Use luaevent's built-in method of repeating an event (fixes a weird crash)

Thu, 17 Dec 2009 16:52:39 +0000

author
Matthew Wild <mwild1@gmail.com>
date
Thu, 17 Dec 2009 16:52:39 +0000
changeset 2366
c3a364342cb4
parent 2365
0bd8408a491c
child 2367
22dc9005360f

util.timer: Use luaevent's built-in method of repeating an event (fixes a weird crash)

util/timer.lua file | annotate | diff | comparison | revisions
--- a/util/timer.lua	Wed Dec 16 00:11:54 2009 +0500
+++ b/util/timer.lua	Thu Dec 17 16:52:39 2009 +0000
@@ -55,10 +55,10 @@
 else
 	local EVENT_LEAVE = (event.core and event.core.LEAVE) or -1;
 	function _add_task(delay, func)
-		event_base:addevent(nil, event.EV_TIMEOUT, function ()
+		event_base:addevent(nil, 0, function ()
 			local ret = func();
 			if ret then
-				_add_task(ret, func);
+				return 0, ret;
 			else
 				return EVENT_LEAVE;
 			end

mercurial