ds_grid_swap_columns
$$\mathbf{G} = \begin{array}{|c|c|c|c|} \hline \color{#F80}A&B&\color{#C8F}C&D \\\hline \color{#F80}E&F&\color{#C8F}G&H \\\hline \color{#F80}I&J&\color{#C8F}K&L \\\hline \color{#F80}M&N&\color{#C8F}O&P \\\hline \end{array} \qquad f(\mathbf{G},0,2) = \begin{array}{|c|c|c|c|} \hline \color{#C8F}C&B&\color{#F80}A&D \\\hline \color{#C8F}G&F&\color{#F80}E&H \\\hline \color{#C8F}K&J&\color{#F80}I&L \\\hline \color{#C8F}O&N&\color{#F80}M&P \\\hline \end{array}$$
- ds_grid_swap_columns(id,col1,col2)
- Exchanges the contents of two entire grid columns.
COPY/// ds_grid_swap_columns(id,col1,col2)
//
// Exchanges the contents of two entire grid columns.
//
// id grid data structure, real
// col1 1st column of the exchange, real
// col2 2nd column of the exchange, real
//
/// gmlscripts.pro/license
{
var i, temp;
i = 0;
repeat (ds_grid_height(argument0)) {
temp = ds_grid_get(argument0, argument1, i);
ds_grid_set(argument0, argument1, i, ds_grid_get(argument0, argument2, i));
ds_grid_set(argument0, argument2, i, temp);
i += 1;
}
return 0;
}
Contributors: Quimp
GitHub: View · Commits · Blame · Raw