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

This commit is contained in:
Matthew Wild 2009-12-17 16:52:39 +00:00
parent 34e97d4a3c
commit d7d5b34c60

View 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