DaveInDev
Member
Hi,
I have an array of structs called tab (all have the same variables), and let say that I would like to insert in position 5 a copy of the struct in position 3.
If I just make array_insert(tab,5,tab[3]), it will only copy a reference or the id of the struct in position 3.
So if I modify tab[5] content, I will also modify tab[3] content...
Thats' not what I want, I need to clone the struct in tab[3] to create a brand new object.
How can I do this ? I do not find any builtin function, nor any answer if I type "GMS2 copy struct" in google...
Am I supposed to create mu own deepcopy function that would recursively copy my struct ? (BTW, did I mention that my struct contains arrays and other structs ?... )
I have an array of structs called tab (all have the same variables), and let say that I would like to insert in position 5 a copy of the struct in position 3.
If I just make array_insert(tab,5,tab[3]), it will only copy a reference or the id of the struct in position 3.
So if I modify tab[5] content, I will also modify tab[3] content...
Thats' not what I want, I need to clone the struct in tab[3] to create a brand new object.
How can I do this ? I do not find any builtin function, nor any answer if I type "GMS2 copy struct" in google...
Am I supposed to create mu own deepcopy function that would recursively copy my struct ? (BTW, did I mention that my struct contains arrays and other structs ?... )