You are currently viewing the GMLscripts.com static mirror. Forum access and script submissions are not available through this mirror.

Invert GMLscripts.com

ds_grid_duplicate

This simple script will create and return a new grid data structure that is an exact duplicate of a given grid data structure.

ds_grid_duplicate(grid)
Returns a duplicate of the given grid.
COPY/// @func   ds_grid_duplicate(grid)
///
/// @desc   Returns a duplicate of the given grid.
///
/// @param  {grid}      grid        ds_grid to duplicate
///
/// @return {grid}      duplicated grid
///
/// GMLscripts.com

function ds_grid_duplicate(grid)
{
    var w = ds_grid_width(grid);
    var h = ds_grid_height(grid);
    var newgrid = ds_grid_create(w, h);
    ds_grid_copy(newgrid, grid);
    return newgrid;
}

Contributors: xot

GitHub: View · Commits · Blame · Raw