Invert GMLscripts.com

ds_grid_swap_rows

$$\mathbf{G} = \begin{array}{|c|c|c|c|} \hline \color{#F80}A&\color{#F80}B&\color{#F80}C&\color{#F80}D \\\hline E&F&G&H \\\hline \color{#C8F}I&\color{#C8F}J&\color{#C8F}K&\color{#C8F}L \\\hline M&N&O&P \\\hline \end{array} \qquad f(\mathbf{G},0,2) = \begin{array}{|c|c|c|c|} \hline \color{#C8F}I&\color{#C8F}J&\color{#C8F}K&\color{#C8F}L \\\hline E&F&G&H \\\hline \color{#F80}A&\color{#F80}B&\color{#F80}C&\color{#F80}D \\\hline M&N&O&P \\\hline \end{array}$$

ds_grid_swap_rows(id,row1,row2)
Exchanges the contents of two entire grid rows.
COPY/// ds_grid_swap_rows(id,row1,row2)
//
//  Exchanges the contents of two entire grid rows.
//
//      id          grid data structure, real
//      row1        1st row of the exchange, real
//      row2        2nd row of the exchange, real
//
/// GMLscripts.com/license
{
    var i, temp;
    i = 0;
    repeat (ds_grid_width(argument0)) {
        temp = ds_grid_get(argument0, i, argument1);
        ds_grid_set(argument0, i, argument1, ds_grid_get(argument0, i, argument2));
        ds_grid_set(argument0, i, argument2, temp);
        i += 1;
    }
    return 0;
}

Contributors: Quimp

GitHub: View · Commits · Blame · Raw