With this function you can copy the contents of one grid into another one. Both grids must have been created previously using the ds_grid_create() function.
This will resize the destination grid to be the same size as the source grid.
ds_grid_copy(destination, source);
Argument | Type | Description |
---|---|---|
destination | DS Grid | This index of the grid to copy to. |
source | DS Grid | This index of the grid to copy from. |
N/A
n_grid = ds_grid_create(1, 1);
ds_grid_copy(n_grid, a_grid);
ds_grid_clear(a_grid, -1)
The above code creates a new DS grid, then copies information from the previous grid to the new one. The starting size of the destination DS grid does not matter as the size of the source grid will be applied to it before any data is copied.
Finally it clears the old grid so that all cells have a value of -1.