ds_map_replace_map

list

Replace a ds_map that has been previously added into a distinct ds_map, with another ds_map.

Syntax:

ds_map_replace_map(id, key, value)


Argument Description
id The id of the ds_map to use.
key The key to replace.
value The id of the ds_map to use to replace the one previously stored in the given key.


Returns: N/A


Description

With this function you can replace a ds_map that has been stored in the given "key" with another map that has been created previously. This function is designed for creating JSON compatible maps which you would then encode using json_encode and should only be used in conjunction with that functionality.


Example:

var temp_map = ds_map_create();
ds_map_add_list(temp_map, "list", j_list);
ds_map_add(temp_map, "array", j_array);
ds_map_replace_map(j_map, "maps", temp_map);
var j = json_encode(j_map);
ds_map_destroy(temp_map);

The above code will create a ds_map and populate it with an array and a ds_list before replacing a previously stored map in the ds_map "j_map".


Back: DS Maps
Next: ds_map_exists
© Copyright YoYo Games Ltd. 2018 All Rights Reserved