aboutsummaryrefslogtreecommitdiffstats
path: root/util/set.lua
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2015-05-13 17:00:27 +0100
committerMatthew Wild <mwild1@gmail.com>2015-05-13 17:00:27 +0100
commita885794fccabfc6dc8cc8e52f83c8ac865ddd8c8 (patch)
tree65bc2e4d57655c0f62aec527649de4e5f46296d4 /util/set.lua
parentdaec51c435ca77914271200607841d55ff7408d7 (diff)
parent2f7ac943416fa13023e9d061ffc8020811a4ebf0 (diff)
downloadprosody-a885794fccabfc6dc8cc8e52f83c8ac865ddd8c8.tar.gz
prosody-a885794fccabfc6dc8cc8e52f83c8ac865ddd8c8.zip
Merge 0.10->trunk
Diffstat (limited to 'util/set.lua')
-rw-r--r--util/set.lua11
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