Comparison

util/events.lua @ 6648:999434eb1bbf

util.events: Add local reference to table.remove (fixes traceback)
author Kim Alvefur <zash@zash.se>
date Tue, 05 May 2015 00:41:39 +0200
parent 6641:b44ebfe81c73
child 6665:e923d7cb8430
comparison
equal deleted inserted replaced
6646:9795b8cf14f1 6648:999434eb1bbf
7 -- 7 --
8 8
9 9
10 local pairs = pairs; 10 local pairs = pairs;
11 local t_insert = table.insert; 11 local t_insert = table.insert;
12 local t_remove = table.remove;
12 local t_sort = table.sort; 13 local t_sort = table.sort;
13 local setmetatable = setmetatable; 14 local setmetatable = setmetatable;
14 local next = next; 15 local next = next;
15 16
16 module "events" 17 module "events"
116 w = wrappers[event_name]; 117 w = wrappers[event_name];
117 end 118 end
118 if not w then return; end 119 if not w then return; end
119 for i = #w, 1 do 120 for i = #w, 1 do
120 if w[i] == wrapper then 121 if w[i] == wrapper then
121 table.remove(w, i); 122 t_remove(w, i);
122 end 123 end
123 end 124 end
124 if #w == 0 then 125 if #w == 0 then
125 if event_name == nil then 126 if event_name == nil then
126 global_wrappers = nil; 127 global_wrappers = nil;