Ar Last

From GECK

Revision as of 04:43, 12 July 2014 by Odessa (Talk | contribs) (Created page with "{{Function |origin = NVSE |summary = Returns the last key of an array. For regular arrays (list arrays) this is equivalent to <b>(Ar_Size RegArray - 1)</b>. This function is...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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

(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

Personal tools