Changeset

11788:1ceee8becb1a

util.set: Add :contains_set() method
author Matthew Wild <mwild1@gmail.com>
date Sun, 12 Sep 2021 10:51:27 +0100
parents 11787:3ae6fa901a8b
children 11789:f3085620b6ff
files util/set.lua
diffstat 1 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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