Ar Size

Revision as of 20:01, 27 June 2014 by imported>Odessa (created)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
< [[::Category:Functions|Category:Functions]]

A function added by the New Vegas Script Extender.

Description

Added by NVSE V4. Returns the number of elements contained in an array, or -1 if the array has not been initialized

Syntax

(int) Ar_Size ToCheck:array

Example

array_var aBeatles
int iSize

let iSize := Ar_Size aBeatles ; iSize == -1, not initialized

let aBeatles := Ar_List JohnREF, PaulREF, GeorgeREF, RingoREF

Ar_Size aBeatles ; now returns 4

To use in a conditional statement, Eval is required:

array_var SomeArray

if eval Ar_Size SomeArray > 5
   ; SomeArray contains more than 5 elements
endif

Notes

  • Since arrays are zero based indexed, the last element is always:
let iLastIndex := (Ar_Size SomeArray) - 1

See Also