diff options
author | Barichello <artur@barichello.me> | 2022-02-19 01:45:05 -0300 |
---|---|---|
committer | Barichello <artur@barichello.me> | 2022-02-19 01:45:05 -0300 |
commit | d61f55337296574ed5eb177833b665663fe1d121 (patch) | |
tree | 5a96606c9af4515d8c5a2311aca86a0d0b07e889 | |
parent | f8d93a1085c9a35762eaa2cd26304c722306dd19 (diff) | |
download | NorthstarMods-d61f55337296574ed5eb177833b665663fe1d121.tar.gz NorthstarMods-d61f55337296574ed5eb177833b665663fe1d121.zip |
Add FindAndRemove utility
-rw-r--r-- | Northstar.CustomServers/mod/scripts/vscripts/sh_utility_all.gnut | 9 |
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 ) + } +} |