From c8600cd24bb5d81772ccd1694388414885f49a1c Mon Sep 17 00:00:00 2001 From: Applevangelist Date: Fri, 30 Sep 2022 14:42:17 +0200 Subject: [PATCH] *SET * Added IsInSet() --- Moose Development/Moose/Core/Set.lua | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/Moose Development/Moose/Core/Set.lua b/Moose Development/Moose/Core/Set.lua index 1f43c2659..4e279d56f 100644 --- a/Moose Development/Moose/Core/Set.lua +++ b/Moose Development/Moose/Core/Set.lua @@ -813,14 +813,31 @@ do -- SET_BASE return true end - --- Decides whether to include the Object. + --- Decides whether an object is in the SET -- @param #SET_BASE self -- @param #table Object -- @return #SET_BASE self - function SET_BASE:IsInSet( ObjectName ) + function SET_BASE:IsInSet( Object ) self:F3( Object ) - - return true + local outcome = false + local name = Object:GetName() + self:ForEach( + function(object) + if object:GetName() == name then + outcome = true + end + end + ) + return outcome + end + + --- Decides whether an object is **not** in the SET + -- @param #SET_BASE self + -- @param #table Object + -- @return #SET_BASE self + function SET_BASE:IsNotInSet( Object ) + self:F3( Object ) + return not self:IsInSet(Object) end --- Gets a string with all the object names.