Deltarune (Chapter 5) script viewer

← back to main script listing

gml_GlobalScript_scr_copy_struct

(view raw script w/o annotations or w/e)
1
function 
scr_copy_struct
scr_copy_struct

function
scr_copy_struct(arg0)
{ var newCopy = {}; var keys = variable_struct_get_names(arg0); var i = array_length(keys) - 1; while (i >= 0) { var key = keys[i]; var value = variable_struct_get(arg0, key); variable_struct_get(arg0, key); variable_struct_set(newCopy, key, value); i--; } return newCopy; }
(arg0)
2
{
3
    var newCopy = {};
4
    var keys = variable_struct_get_names(arg0);
5
    var i = array_length(keys) - 1;
6
    while (i >= 0)
7
    {
8
        var key = keys[i];
9
        var value = variable_struct_get(arg0, key);
10
        variable_struct_get(arg0, key);
11
        variable_struct_set(newCopy, key, value);
12
        i--;
13
    }
14
    return newCopy;
15
}