From 90d20076c9e49404f0354cf87920dae97ef70141 Mon Sep 17 00:00:00 2001 From: Applevangelist Date: Sat, 10 Aug 2024 18:53:45 +0200 Subject: [PATCH] #SET_CLIENT - Added FilterAlive() --- Moose Development/Moose/Core/Set.lua | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Moose Development/Moose/Core/Set.lua b/Moose Development/Moose/Core/Set.lua index 002d08392..b597c97f9 100644 --- a/Moose Development/Moose/Core/Set.lua +++ b/Moose Development/Moose/Core/Set.lua @@ -4460,6 +4460,23 @@ do -- SET_CLIENT return self end + --- Builds a set of units which exist and are alive. + -- @param #SET_CLIENT self + -- @return #SET_CLIENT self + function SET_CLIENT:FilterAlive() + self:FilterFunction( + function(unit) + if unit and unit:IsExist() and unit:IsAlive() then + return true + else + return false + end + end + ) + return self + end + + --- Builds a set of clients in zones. -- @param #SET_CLIENT self -- @param #table Zones Table of Core.Zone#ZONE Zone objects, or a Core.Set#SET_ZONE