comparison util/events.lua @ 3779:fb1d2e5a2fc9

Merge with Florob
author Matthew Wild <mwild1@gmail.com>
date Sat, 18 Dec 2010 23:08:21 +0000
parents bc4f67a0658d
children 60b3b6d27364
comparison
equal deleted inserted replaced
3778:bd1845f9d5a4 3779:fb1d2e5a2fc9
43 local function remove_handler(event, handler) 43 local function remove_handler(event, handler)
44 local map = event_map[event]; 44 local map = event_map[event];
45 if map then 45 if map then
46 map[handler] = nil; 46 map[handler] = nil;
47 handlers[event] = nil; 47 handlers[event] = nil;
48 if next(map) == nil then
49 event_map[event] = nil;
50 end
48 end 51 end
49 end; 52 end;
50 local function add_handlers(handlers) 53 local function add_handlers(handlers)
51 for event, handler in pairs(handlers) do 54 for event, handler in pairs(handlers) do
52 add_handler(event, handler); 55 add_handler(event, handler);