Comparison

util/events.lua @ 5749:60b3b6d27364

util.events: Remove varargs, event handlers can now only accept a single parameter
author Matthew Wild <mwild1@gmail.com>
date Mon, 15 Jul 2013 12:15:51 +0100
parent 3776:bc4f67a0658d
child 5776:bd0ff8ae98a8
comparison
equal deleted inserted replaced
5748:cef2a1122b43 5749:60b3b6d27364
58 local function remove_handlers(handlers) 58 local function remove_handlers(handlers)
59 for event, handler in pairs(handlers) do 59 for event, handler in pairs(handlers) do
60 remove_handler(event, handler); 60 remove_handler(event, handler);
61 end 61 end
62 end; 62 end;
63 local function fire_event(event, ...) 63 local function fire_event(event_name, event_data)
64 local h = handlers[event]; 64 local h = handlers[event_name];
65 if h then 65 if h then
66 for i=1,#h do 66 for i=1,#h do
67 local ret = h[i](...); 67 local ret = h[i](event_data);
68 if ret ~= nil then return ret; end 68 if ret ~= nil then return ret; end
69 end 69 end
70 end 70 end
71 end; 71 end;
72 return { 72 return {