aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2009-04-22 18:03:42 +0100
committerMatthew Wild <mwild1@gmail.com>2009-04-22 18:03:42 +0100
commit0d98ee54b5a332e5d6a42aebf85026da2d432d2f (patch)
tree370491cef71fe075e9cbabec4b734503a513ebe6
parent901af1535f708d391d10e7c116d4a9538b89dac2 (diff)
downloadprosody-0d98ee54b5a332e5d6a42aebf85026da2d432d2f.tar.gz
prosody-0d98ee54b5a332e5d6a42aebf85026da2d432d2f.zip
util.set: Add set.xor() to get a set consisting of items not in both sets
-rw-r--r--util/set.lua4
1 files changed, 4 insertions, 0 deletions
diff --git a/util/set.lua b/util/set.lua
index bb318adf..84bfe8c4 100644
--- a/util/set.lua
+++ b/util/set.lua
@@ -141,4 +141,8 @@ function intersection(set1, set2)
return set;
end
+function xor(set1, set2)
+ return union(set1, set2) - intersection(set1, set2);
+end
+
return _M;