Replace a list with another list after it has been added to a ds_map.


GML Code Example

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.


GML Code Example

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);

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".

No Examples Submitted

Does this page need better examples? Be the first to Submit

No Edits Suggested

Is this page unclear or not descriptive enough? Suggest an edit to the page and with enough upvotes your changes will be made.

No Questions Have Been Ask

Do you have a question about this page? Ask it Here