Ar Resize


A function added by the New Vegas Script Extender.


Added by NVSE V4. Usable only with "array" type array variables (array Lists). Resizes an existing array to the specified size. If the new size is a reduction, excess elements are deleted, starting from the last. If the resize is an increase, new elements are appended which each have the optional padding value specified (any item is permitted), or 0 if none was specified.

It does not return an array, it resizes one in place. It returns true (1) if successful and false (0) if it it fails; although it is unlikely one will ever need to bother checking this.


(bool) Ar_Resize List:array NewSize:int PadValue:multi


array_var aBeatles

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

; aBeatles now contains: JohnREF, PaulREF, GeorgeREF, RingoREF

Ar_Resize aBeatles, 2

; aBeatles now contains: JohnREF, PaulREF

Ar_Resize aBeatles, 5, 42

; aBeatles now contains: JohnREF, PaulREF, 42, 42, 42


  • Alternatively, you can also use Ar_Append to add new elements to an existing array, and Ar_Erase to remove elements. Both these alternatives also resize an array in place.

See Also

Personal tools