Skip to main content

array.resize(newSize, fillValue)

Increases or decreases the size of an array

Availability

Device + Agent

Parameters

Name Type Description
newSize Integer The required size of the array
fillValue Any An optional fill value that can be any Squirrel data type

Returns

Nothing

Description

This method increases or reduces the size of the array. If the resized array will be smaller than the original array, all items within the array with indices greater than the new maximum will be lost. If the resized array will be larger than before, the new items will be set to null unless an optional fill value is supplied. All new items will take this value.

The fill value can be any Squirrel data type. However, if functions and/or objects are added to the array, the array can no longer be serialized (see Squirrel Data Serialization).

Example Code