Comparison

util/set.lua @ 5908:081a91507e4f

Merge 0.9->0.10
author Matthew Wild <mwild1@gmail.com>
date Sun, 10 Nov 2013 18:49:34 +0000
parent 5817:6e087f3b8f3b
parent 5906:071a7e461ae7
child 6673:b123fcd65d2e
comparison
equal deleted inserted replaced
5904:c1bc2c20a80a 5908:081a91507e4f
21 end 21 end
22 function set_mt.__sub(set1, set2) 22 function set_mt.__sub(set1, set2)
23 return _M.difference(set1, set2); 23 return _M.difference(set1, set2);
24 end 24 end
25 function set_mt.__div(set, func) 25 function set_mt.__div(set, func)
26 local new_set, new_items = _M.new(); 26 local new_set = _M.new();
27 local items, new_items = set._items, new_set._items; 27 local items, new_items = set._items, new_set._items;
28 for item in pairs(items) do 28 for item in pairs(items) do
29 local new_item = func(item); 29 local new_item = func(item);
30 if new_item ~= nil then 30 if new_item ~= nil then
31 new_items[new_item] = true; 31 new_items[new_item] = true;