ds_map_replace_map

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

Syntax:

GML Code Example

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:

GML Code 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



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