Difference between revisions of "ResizeIntArray - Utility"
Jump to navigation
Jump to search
m |
|||
Line 17: | Line 17: | ||
== Return Value == | == Return Value == | ||
An Int array of '''''size''''' length. | An Int array of '''''size''''' length. Element values will match those provided by the source array. If new size exceeds length of source array, new elements will will have the value of the fill (if specified) or zero if not. | ||
== Examples == | == Examples == |
Revision as of 21:21, 3 October 2024
SKSE member of: Utility Script
Resizes an already existing array of Int values to the specified length. (This function requires SKSE)
Be careful when using this function. It is possible to create arrays longer than 128 elements, and size is treated as an unsigned integer. Negative numbers will produce extremely large values, which can cause major issues.
Syntax
int[] Function ResizeIntArray(int[] source, int size, int fill = 0) global native
Parameters
- source: an existing array of int values.
- size: new size of the array.
- fill: a value to fill the array with.
Return Value
An Int array of size length. Element values will match those provided by the source array. If new size exceeds length of source array, new elements will will have the value of the fill (if specified) or zero if not.
Examples
; let's make array length equal to available perk points, and fill all elements with 9
int[] pointsArray
pointsArray = Utility.ResizeIntArray(pointsArray, Game.GetPerkPoints(), 9)
Notes
- No need to actually create an array with new, declaring an array variable is enough.