Construct 3 icon

Construct 3

Documentation

Array script interface

Ashley's avatar
Medal
Construct Team Founder
Published 12 Aug, 2019
209 words
<1 min

The IArrayInstance interface derives from IInstance to add APIs specific to the Array plugin.

Array APIs

width

height

depth

Retrieve the current dimensions of the array.

setSize(w, h = 1, d = 1)

Set the size of the array in up to three dimensions. For one or two dimensional arrays, the later parameters can be omitted as they default to 1. (Note passing 0 for any dimension will create an array with zero elements that cannot store any data.) If the array grows, new elements have the value 0. If the array shrinks, elements are removed.

getAt(x, y = 0, z = 0)

Retrieve an element from the array at the given X, Y and Z co-ordinates. For one or two dimensional access, the later parameters can be omitted as they default to 0.

setAt(val, x, y = 0, z = 0)

Set an element in the array at the given X, Y and Z co-ordinates. val must be a number or string. For one or two dimensional arrays, the later parameters can be omitted as they default to 0.