The "ds_list_replace_list" Function


ds_list_replace_list(id, oldlist, newlist);
idds_listThe data structure to add new data to
oldlistds_listThe data structure to be replaced
newlistds_listThe data structure to be added


Replaces a ds_list previously added to another ds_list with the contents of a new ds_list.


Because data structures are referenced by numerical values, this script may not behave as you expect! If a numerical entry in the parent ds_list happens to match the value of a child ds_list, there is no guarantee which value will be replaced!

Intended only for use with JSON functions. Normally, adding one data structure to another simply stores a reference to the data structure, therefore this function is necessary to flag the list value as a data structure itself so its contents are written to the JSON file.


my_list = ds_list_create();
my_other_list = ds_list_create();
my_new_list = ds_list_create();
ds_list_add_list(my_list, my_other_list);
ds_list_replace_list(my_list, my_other_list, my_new_list);