Changeset

2965:0fe9cfaeaed7

Merge 0.7->trunk
author Matthew Wild <mwild1@gmail.com>
date Wed, 07 Apr 2010 21:01:06 +0100
parents 2963:abd1a30330e0 (current diff) 2964:49b5c87d2fa0 (diff)
children 2966:e78436234775
files
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/util/timer.lua	Wed Apr 07 17:41:35 2010 +0100
+++ b/util/timer.lua	Wed Apr 07 21:01:06 2010 +0100
@@ -55,11 +55,12 @@
 else
 	local EVENT_LEAVE = (event.core and event.core.LEAVE) or -1;
 	function _add_task(delay, func)
-		event_base:addevent(nil, 0, function ()
+		local event_handle;
+		event_handle = event_base:addevent(nil, 0, function ()
 			local ret = func();
 			if ret then
 				return 0, ret;
-			else
+			elseif event_handle then
 				return EVENT_LEAVE;
 			end
 		end