ds_map_replace_list


描述

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)

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


Returns:

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