Ar Next

From GECK
Jump to: navigation, search


A function added by the New Vegas Script Extender.

Description

Returns the next key of an array, after the one 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 elements were inserted.

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

Syntax

[help]
(key:int/float/string) Ar_Next Source:array Key:int/float/string 

Example

array_var MyMap
float MapKey ; * or string_var as appropriate for array

let MapKey := Ar_First MyMap ; * The First Key

let MapKey := Ar_Next MyMap, MapKey ; * The Next Key

if MapKey == Ar_BadNumericIndex
    ; Then there is no next key in the map
endif

See Also