Skip to main content

The "ds_grid_insert_row" Function

Syntax#

ds_grid_insert_row(id, row, [value]);
ArgumentTypeDescription
idds_gridThe data structure to insert a row into
rowintegerThe index of the new row to insert
[value]real/stringOptional: A value to assign to all new cells (default 0)

Description#

Adds a new row to a ds_grid at the given index, shifting any rows that follow. Optionally also sets a value for empty new cells in the grid (default value is 0).

When complete, ds_grid_height will be increased by 1. For this reason, the new row index can be input as less than or equal to the current value of ds_grid_height.

Example#

ds_grid_insert_row(my_grid, ds_grid_height(my_grid) - 2);
ds_grid_insert_row(my_grid, ds_grid_height(my_grid) - 2, -1);