Add - Array

Revision as of 18:40, 11 July 2014 by imported>Plplecuyer (Created page with "Category:Scripting Category:Papyrus '''Member of:''' All arrays Adds a new item to the array at the end, expanding it to fit. May add multiple items at once. == Syntax ...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Member of: All arrays

Adds a new item to the array at the end, expanding it to fit. May add multiple items at once.

Syntax

Function Add(;/element type/; akElement, int aiCount = 1) native

Parameters

  • akElement: The element to locate
  • aiCount: The number of items to add
    • Default: 1

Return Value

None

Examples

; Add the number 4 to the end of the array
MyIntArray.Add(4)


; Add the number 1 four times into the array
MyIntArray.Add(1, 4)

Notes

If you add a struct to an array it will only be a single struct, not multiple copies of the struct. Add essentially works like a while loop, continually adding the thing you give it to the array, after saving that thing off into a variable.

See Also