diff options
author | Matthew Wild <mwild1@gmail.com> | 2021-09-12 10:51:27 +0100 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2021-09-12 10:51:27 +0100 |
commit | a278dc21348287ca1dca91aa836a436a808b16f6 (patch) | |
tree | 46e77bab9c43c2d0397c4a258410e9e75e8ba3aa /util/set.lua | |
parent | edb6956ad524febe58d5575d0bf42b4a7ddabc1c (diff) | |
download | prosody-a278dc21348287ca1dca91aa836a436a808b16f6.tar.gz prosody-a278dc21348287ca1dca91aa836a436a808b16f6.zip |
util.set: Add :contains_set() method
Diffstat (limited to 'util/set.lua')
-rw-r--r-- | util/set.lua | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/util/set.lua b/util/set.lua index 7e600ebd..69dfef5d 100644 --- a/util/set.lua +++ b/util/set.lua @@ -52,6 +52,15 @@ local function new(list) return items[item]; end + function set:contains_set(other_set) + for item in other_set do + if not self:contains(item) then + return false; + end + end + return true; + end + function set:items() return next, items; end |