Software /
code /
prosody
Comparison
util/set.lua @ 5909:d6b3891f186c
Merge 0.10->trunk
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Sun, 10 Nov 2013 18:50:01 +0000 |
parent | 5908:081a91507e4f |
child | 6673:b123fcd65d2e |
comparison
equal
deleted
inserted
replaced
5905:91b48772b27b | 5909:d6b3891f186c |
---|---|
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; |