Difference between revisions of "Ar Size"

From the Fallout3 GECK Wiki
Jump to navigation Jump to search
imported>Odessa
(created)
 
imported>Odessa
(removed confusing note)
 
Line 12: Line 12:
<pre>
<pre>
array_var aBeatles
array_var aBeatles
int iSize


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


let aBeatles := Ar_List JohnREF, PaulREF, GeorgeREF, RingoREF
let aBeatles := Ar_List JohnREF, PaulREF, GeorgeREF, RingoREF
Line 22: Line 21:
</pre>
</pre>


To use in a conditional statement, [[Eval]] is required:
Conditional example:
<pre>
<pre>
array_var SomeArray
if eval Ar_Size SomeArray > 5
if eval Ar_Size SomeArray > 5
   ; SomeArray contains more than 5 elements
   ; SomeArray contains more than 5 elements
endif
endif
</pre>
==Notes==
*Since arrays are zero based indexed, the last element is always:
<pre>
let iLastIndex := (Ar_Size SomeArray) - 1
</pre>
</pre>
==See Also==
==See Also==

Latest revision as of 20:27, 28 June 2014

< [[::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

[help]
(int) Ar_Size ToCheck:array

Example

array_var aBeatles

Ar_Size aBeatles ; returns -1, not initialized

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

Ar_Size aBeatles ; now returns 4

Conditional example:

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

See Also