The "ds_list_replace_map" Function

Syntax

ds_list_replace_map(id, oldlist, newlist);
ArgumentTypeDescription
idds_listThe data structure to add new data to
oldmapds_mapThe data structure to be replaced
newmapds_mapThe data structure to be added

Description

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

warning

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_map, 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.

Example

my_list = ds_list_create();
my_map = ds_map_create();
my_new_map = ds_map_create();
ds_list_add_map(my_list, my_map);
ds_list_replace_map(my_list, my_map, my_new_map);