Comparison

util/filters.lua @ 3139:7b4f180d7c6f

util.filters: Don't traceback with no filters of a type added
author Matthew Wild <mwild1@gmail.com>
date Wed, 02 Jun 2010 13:03:55 +0100
parent 3135:f29a297471e3
child 3140:8c6ed6fd2d35
comparison
equal deleted inserted replaced
3138:d6151c9a6f7e 3139:7b4f180d7c6f
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];
19 for i = 1, #filter_list do 19 if filter_list then
20 data = filter_list[i](data); 20 for i = 1, #filter_list do
21 data = filter_list[i](data);
22 end
21 end 23 end
22 return data; 24 return data;
23 end 25 end
24 end 26 end
25 27