Difference between revisions of "Ar Find"
Jump to navigation
Jump to search
imported>Odessa (created) |
imported>Odessa (modified example for clarity) |
||
Line 20: | Line 20: | ||
if eval (Ar_Find RingoREF, aBeatles) != Ar_BadNumericIndex | if eval (Ar_Find RingoREF, aBeatles) != Ar_BadNumericIndex | ||
; * Ringo is found somewhere in the array aBeatles | ; * Ringo is found somewhere in the array aBeatles | ||
elseif eval (Ar_Find GeorgeREF, aBeatles, 1:2) != Ar_BadNumericIndex | elseif eval (Ar_Find GeorgeREF, aBeatles, 1:2) != Ar_BadNumericIndex |
Revision as of 18:24, 28 June 2014
< [[::Category:Functions|Category:Functions]]
A function added by the New Vegas Script Extender.
Description
Added by NVSE V4. Returns the key of the first occurrence of a value in an array, or optionally within a sub range of the array. If the value searched for is not found, it returns the constant Ar_BadNumericIndex (-99999.0) for numeric indexed arrays, or the constant Ar_BadStringIndex (empty string) for those that are string indexed.
Syntax
(int-OR-string) Ar_Find Value:multi ToSearch:array Subrange:range
Example
array_var aBeatles let aBeatles := Ar_List JohnREF, PaulREF, GeorgeREF, RingoREF ; * example context if eval (Ar_Find RingoREF, aBeatles) != Ar_BadNumericIndex ; * Ringo is found somewhere in the array aBeatles elseif eval (Ar_Find GeorgeREF, aBeatles, 1:2) != Ar_BadNumericIndex ; * George is found within the subrange (second to third elements) of array endif