getArray

Syntax

int getArray (int nr, int x, int y, int z)

Arguments

nr
Number of the array. Values from 0 to 99 are accepted.
x, y, z
x, y, and z coordinates of a cell in the array. If you allocated a one-dimensional array, set y and z to zero. If you allocated a two-dimensional array, set z to zero.

Return

Returns the value that was stored at the specified coordinates in the array.
If the specified coordinates lie outside the array, getArray will follow the edge-mirroring behavior defined by set_edge_mode for the x and y co-ordinates. If you don't want this behaviour, you can use the unsafe __getArray function instead (which will crash or give undesired results if the co-ordinates are outside the array bounds).
By default (ie edgeMode == 0), x and y will be clamped to between 0 and X-1 or Y-1 as appropriate, while the z co-ordinate remains unchanged. If edgeMode == 1, getArray will return a zero value.
If the co-ordinates still lie outside the array, getArray will return zero.

Description

It lets you read a value from an array.

Example

See allocArray

See Also

allocArray, freeArray, putArray, getArrayDim, copyArray, set_edge_mode

Comments

Everyone can add his comments about his experiences with this function here. Tips for using it are welcome, too.