Ar Size

From GECK

Revision as of 19:01, 27 June 2014 by Odessa (Talk | contribs) (created)

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

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

Personal tools