ds_map_replace_map


描述

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.


语法:

ds_map_replace_map(id, key, value)

参数 描述
id The id of the ds_map to use.
key The key to replace.
The id of the ds_map to use to replace the one previously stored in the given key.


Returns:

N/A(无返回值)


例如:

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