util.set: Add :contains_set() method
authorMatthew Wild <mwild1@gmail.com>
Sun, 12 Sep 2021 10:51:27 +0100
changeset 11792 1ceee8becb1a
parent 11791 3ae6fa901a8b
child 11793 f3085620b6ff
util.set: Add :contains_set() method
util/set.lua
--- a/util/set.lua	Sun Sep 12 10:50:20 2021 +0100
+++ b/util/set.lua	Sun Sep 12 10:51:27 2021 +0100
@@ -52,6 +52,15 @@
 		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