ds_map_replace_list(id, key, value)
Argument | Description |
---|---|
id | The id of the map to use. |
key | The key to replace. |
value | The id of the ds_list to use to replace the one previously stored in the given key. |
Returns: N/A
With this function you can replace a ds_list that has been stored in the given "key" with another list 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.
var j_list = ds_list_create();
ds_list_add(j_list, health);
ds_list_add(j_list, lives);
ds_list_add(j_list, score);
ds_map_replace_list(j_map, "list", j_list);
var j = json_encode(j_map);
ds_list_destroy(j_list);
The above code will create a ds_list and populate it with the values of various global variables before replacing a previously stored list in the ds_map "j_map".