The "array_width" Function

Syntax

array_width(id);
ArgumentTypeDescription
idarrayThe index of a previously-created array to check

Description

Returns the number of horizontal cells present in a 2D array. While this script can be used on a 1D as well, it will always return 1.

Vanilla GML array length and height functions reverse the X and Y values relative to data structures like ds_grid. This is confusing. By contrast, GML+ uses the same dimension for width and height as other data structures.

Example

var last_cell = array_width(my_array) - 1;