The "ds_grid_insert_col" Function

Syntax

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

Description

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

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

Example

ds_grid_insert_col(my_grid, ds_grid_width(my_grid) - 2);
ds_grid_insert_col(my_grid, ds_grid_width(my_grid) - 2, -1);