From d61f55337296574ed5eb177833b665663fe1d121 Mon Sep 17 00:00:00 2001 From: Barichello Date: Sat, 19 Feb 2022 01:45:05 -0300 Subject: Add FindAndRemove utility --- Northstar.CustomServers/mod/scripts/vscripts/sh_utility_all.gnut | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'Northstar.CustomServers/mod/scripts/vscripts') 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 arr, entity target ) +{ + int findIndex = arr.find( target ) + if ( findIndex != -1 ) + { + arr.remove( findIndex ) + } +} -- cgit v1.2.3