Ar Next

From the Fallout3 GECK Wiki
Revision as of 03:54, 12 July 2014 by imported>Odessa (Created page with "{{Function |origin = NVSE |summary = Returns the next key of an array, after that specified. For regular arrays (list arrays) this is just equivalent to <b>(SpecifiedKey + 1...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
< [[::Category:Functions|Category:Functions]]

A function added by the New Vegas Script Extender.

Description

Returns the next key of an array, after that specified. For regular arrays (list arrays) this is just equivalent to (SpecifiedKey + 1). This function is most useful for map and stringmap arrays, where keys are dynamic. Note that map and stringmap arrays are always sorted in ascending numeric or alphanumeric order, regardless of the order of element insertion.

Returns a bad index (Ar_BadNumericIndex or Ar_BadStringIndex) if there is no next key in the array.

Syntax

[help]
(key:int-or-float-or-string) Ar_Next Source:array Previous:key

Example

array_var MyMap
int iKey ; * or float/string_var as appropriate for array

let iKey := Ar_First MyMap ; * get first element

while iKey != Ar_BadNumericIndex
    ; do something for every valid key in array
    let iKey := Ar_Next MyMap, iKey
loop

See Also