aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2012-05-24 18:51:18 +0100
committerMatthew Wild <mwild1@gmail.com>2012-05-24 18:51:18 +0100
commitea48b240ef8926f1e614cac9b0d582fb34044bfb (patch)
treeb761f14e9909fe6a4ac91356bbcb131c27ef1e6f
parent81a34bee5e7bbf54c85c0167a61656123414eaa2 (diff)
downloadprosody-ea48b240ef8926f1e614cac9b0d582fb34044bfb.tar.gz
prosody-ea48b240ef8926f1e614cac9b0d582fb34044bfb.zip
util.set: Change '/' operator from filter to map+filter (nil to drop from set, false is a valid item). No code found which depends on current behaviour.
-rw-r--r--util/set.lua5
1 files changed, 3 insertions, 2 deletions
diff --git a/util/set.lua b/util/set.lua
index 050446ec..7f45526e 100644
--- a/util/set.lua
+++ b/util/set.lua
@@ -26,8 +26,9 @@ function set_mt.__div(set, func)
local new_set, new_items = _M.new();
local items, new_items = set._items, new_set._items;
for item in pairs(items) do
- if func(item) then
- new_items[item] = true;
+ local new_item = func(item);
+ if new_item ~= nil then
+ new_items[new_item] = true;
end
end
return new_set;