util/events.lua

changeset 1417
b02b22f77326
parent 1181
dffbb7d1da4b
child 1507
92357dffe743
--- a/util/events.lua	Thu Jun 25 17:22:53 2009 +0500
+++ b/util/events.lua	Fri Jun 26 08:52:26 2009 +0500
@@ -53,8 +53,8 @@
 		local h = handlers[event];
 		if not h then h = {}; handlers[event] = h; end
 		local dispatcher = function(...)
-			for _, handler in ipairs(h) do
-				local ret = handler(...);
+			for i=1,#h do
+				local ret = h[i](...);
 				if ret ~= nil then return ret; end
 			end
 		end;
@@ -67,8 +67,8 @@
 	local function fire_event(event, ...) -- FIXME duplicates dispatcher code
 		local h = handlers[event];
 		if h then
-			for _, handler in ipairs(h) do
-				local ret = handler(...);
+			for i=1,#h do
+				local ret = h[i](...);
 				if ret ~= nil then return ret; end
 			end
 		end

mercurial