Skip to main content

The "ds_struct_copy" Function

Syntax#

ds_struct_copy(id);
ArgumentTypeDescription
idstructThe source struct to be copied

Description#

Copies the contents of a given struct and returns a new struct ID. This script will function recursively, also copying any structs and arrays within the root struct.

If the given input is invalid, undefined will be returned instead.

This type of copy operation is also known as a "deep clone", meaning data is truly duplicated in memory rather than merely referenced.

Example#

my_new_struct = ds_struct_copy(my_struct);