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.
ds_map_replace_list(id, key, value)
Argument | Type | Description |
---|---|---|
id | DS Map | The ID of the map to use. |
key | String | The key to replace. |
value | DS List | The ID of the DS list to use to replace the one previously stored in the given key. |
N/A
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.