ds_map_add_list(id, key, value)
|id||The id of the map to use.|
|key||The key for the added list.|
|value||The id of the list to add.|
With this function you can assign a (previously created)
ds_list to a key
within the given ds_map. 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. If
a ds_map has a list added in this way, destroying the parent map
will also destroy the contained lists and free their memory.
var j_list = ds_list_create();
var j_map = ds_map_create();
ds_map_add_list(j_map, "list", j_list);
var j = json_encode(j_map);
The above code will create a list and populate it with the
various values of global variables. This list is then "nested"
within a ds_map, and the map is then encoded into a JSON string,
before the map is destroyed, removing it, and any lists it
contains, from memory.