diff options
author | Matthew Wild <mwild1@gmail.com> | 2015-05-13 17:00:27 +0100 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2015-05-13 17:00:27 +0100 |
commit | 70e77200f7789e9fb606c7e99e30a54aca70c5c5 (patch) | |
tree | 65bc2e4d57655c0f62aec527649de4e5f46296d4 /util/set.lua | |
parent | 125dc63f565a46aedcb1750c45dcc97c71c2c72b (diff) | |
parent | 9bd85eabf029220d25431ab17bc86bf308b51b8d (diff) | |
download | prosody-70e77200f7789e9fb606c7e99e30a54aca70c5c5.tar.gz prosody-70e77200f7789e9fb606c7e99e30a54aca70c5c5.zip |
Merge 0.10->trunk
Diffstat (limited to 'util/set.lua')
-rw-r--r-- | util/set.lua | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/util/set.lua b/util/set.lua index 04f5f0f4..4be39c17 100644 --- a/util/set.lua +++ b/util/set.lua @@ -34,7 +34,7 @@ function set_mt.__div(set, func) 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 @@ function new(list) 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 @@ function new(list) 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 |