Software /
code /
prosody
Diff
util/set.lua @ 4908:8c5b5ebaacb0
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.
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Thu, 24 May 2012 18:51:18 +0100 |
parent | 4544:316e2b09a562 |
child | 5776:bd0ff8ae98a8 |
child | 5813:c888f548876b |
line wrap: on
line diff
--- a/util/set.lua Thu May 24 03:33:14 2012 +0100 +++ b/util/set.lua Thu May 24 18:51:18 2012 +0100 @@ -26,8 +26,9 @@ 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;