Software /
code /
prosody
Diff
util/set.lua @ 6679:96e034508978
Merge 0.10->trunk
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Wed, 13 May 2015 17:00:27 +0100 |
parent | 6675:cb5b56ddabfd |
child | 6777:5de6b93d0190 |
line wrap: on
line diff
--- a/util/set.lua Wed May 06 19:26:53 2015 +0100 +++ b/util/set.lua Wed May 13 17:00:27 2015 +0100 @@ -34,7 +34,7 @@ return new_set; end function set_mt.__eq(set1, set2) - local set1, set2 = set1._items, set2._items; + set1, set2 = set1._items, set2._items; for item in pairs(set1) do if not set2[item] then return false; @@ -66,6 +66,9 @@ local items = setmetatable({}, items_mt); local set = { _items = items }; + -- We access the set through an upvalue in these methods, so ignore 'self' being unused + --luacheck: ignore 212/self + function set:add(item) items[item] = true; end @@ -82,9 +85,9 @@ items[item] = nil; end - function set:add_list(list) - if list then - for _, item in ipairs(list) do + function set:add_list(item_list) + if item_list then + for _, item in ipairs(item_list) do items[item] = true; end end