Ar Last

From GECK
Jump to: navigation, search


A function added by the New Vegas Script Extender.

Description

Returns the last key of an array. For regular arrays (list arrays) this is equivalent to (Ar_Size RegArray - 1). This function is most useful for map and stringmap arrays, where the last key is dynamic. Note that map and stringmap arrays are always sorted in ascending numeric or alphanumeric order, regardless of the order of element insertion.

Syntax

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

Example

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

let iKey := Ar_Last MyMap

if eval MyMap[iKey] == SunnyREF
    ; * SunnyREF is the value corresponding to the last key in MyMap
endif

See Also