util.timer: Use luaevent's built-in method of repeating an event (fixes a weird crash)
authorMatthew Wild <mwild1@gmail.com>
Thu, 17 Dec 2009 16:52:39 +0000 (16:52 +0000)
committerMatthew Wild <mwild1@gmail.com>
Thu, 17 Dec 2009 16:52:39 +0000 (16:52 +0000)
util/timer.lua

index efc1812d3126fccf01b9719967346b77a93d685e..c52d9c68bb2ff81e2d093f9d55a0e6a3baa10f47 100644 (file)
@@ -55,10 +55,10 @@ if not event then
 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