Comparison

util/filters.lua @ 3134:9a29ad6a9b97

util.filters: Expose the initialization function
author Matthew Wild <mwild1@gmail.com>
date Wed, 02 Jun 2010 12:23:07 +0100
parent 3133:d3f16b4c1ecb
child 3135:f29a297471e3
comparison
equal deleted inserted replaced
3133:d3f16b4c1ecb 3134:9a29ad6a9b97
8 8
9 local t_insert, t_remove = table.insert, table.remove; 9 local t_insert, t_remove = table.insert, table.remove;
10 10
11 module "filters" 11 module "filters"
12 12
13 local function initialize_session(session) 13 function initialize(session)
14 local filters = {}; 14 local filters = {};
15 session.filters = filters; 15 session.filters = filters;
16 16
17 function session.filter(type, data) 17 function session.filter(type, data)
18 local filter_list = filters[type]; 18 local filter_list = filters[type];
23 end 23 end
24 end 24 end
25 25
26 function add_filter(session, type, callback, priority) 26 function add_filter(session, type, callback, priority)
27 if not session.filters then 27 if not session.filters then
28 initialize_session(session); 28 initialize(session);
29 end 29 end
30 30
31 local filter_list = session.filters[type]; 31 local filter_list = session.filters[type];
32 if not filter_list then 32 if not filter_list then
33 filter_list = {}; 33 filter_list = {};