Ar Any

From GECK
Jump to: navigation, search


A function added by the New Vegas Script Extender version 6.2.1.

Description

Takes an array and a function and returns true if any of the elements satisfy the function condition.

Syntax

[help]
(0/1) ar_Any source:array conditionFunction:function/lambda 

Example

array_var aIter
array_var aWords = ar_List "spray", "limit", "elite", "exuberant", "destruction", "present"
if ar_Any aWords ({aIter} => *aIter == "spray") ; returns 1
  print "success!"
elseif ar_Any aWords ({aIter} => *aIter == "Aunt Mary") ; returns 0
  print "failure!"
endif

Notes

  • To see why the * operator is used and why aIter is an array_var, see Dereference/Unbox in NVSE Expressions.
  • aIter["key"] will contain the index of aWords. If aWords was a String Map then it would contain the string key.

See Also