aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBarichello <artur@barichello.me>2022-02-19 01:45:05 -0300
committerBarichello <artur@barichello.me>2022-02-19 01:45:05 -0300
commitd61f55337296574ed5eb177833b665663fe1d121 (patch)
tree5a96606c9af4515d8c5a2311aca86a0d0b07e889
parentf8d93a1085c9a35762eaa2cd26304c722306dd19 (diff)
downloadNorthstarMods-d61f55337296574ed5eb177833b665663fe1d121.tar.gz
NorthstarMods-d61f55337296574ed5eb177833b665663fe1d121.zip
Add FindAndRemove utility
-rw-r--r--Northstar.CustomServers/mod/scripts/vscripts/sh_utility_all.gnut9
1 files changed, 9 insertions, 0 deletions
diff --git a/Northstar.CustomServers/mod/scripts/vscripts/sh_utility_all.gnut b/Northstar.CustomServers/mod/scripts/vscripts/sh_utility_all.gnut
index cd5b734b..7f356a18 100644
--- a/Northstar.CustomServers/mod/scripts/vscripts/sh_utility_all.gnut
+++ b/Northstar.CustomServers/mod/scripts/vscripts/sh_utility_all.gnut
@@ -1593,3 +1593,12 @@ bool function StartsWith( string target, string startsWith )
{
return target.find( startsWith ) == 0
}
+
+void function FindAndRemove( array<entity> arr, entity target )
+{
+ int findIndex = arr.find( target )
+ if ( findIndex != -1 )
+ {
+ arr.remove( findIndex )
+ }
+}