ds_list_mark_as_map(id, pos);

参数 描述
id The id of the list to mark.
pos The position within the list to mark.

返回: N/A(无返回值)


This function will "mark" (or "flag") a given position within a previously created ds_list as holding a previously created ds_map. This functionality is designed only for use when encoding JSON strings (which you can create using json_encode) and the complimentary ds map functions.

NOTE: Once a ds_list has had a value within it flagged as another list or map, destroying the list will also destroy the marked lists and maps too. This means that you do not have to manually go through the list contents and destroy the marked data structures individually before destroying the "parent" list.


var sub_map = ds_map_create();
ds_map_add(sub_map, "player", player_array);
ds_map_add(sub_map, "enemy", enemy_array);
ds_list_add(j_list, sub_map);
ds_list_mark_as_map(j_list, 0);

The above code creates a ds_map and then populates it with two keys, each containing an array of values. This map is then added into the given ds_list, and the position "marked" as such so that it can be correctly encoded later.

上一页: DS Lists
下一页: ds_list_create
© Copyright YoYo Games Ltd. 2018 All Rights Reserved