ds_list_mark_as_list(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 another ds_list. 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 j_list = ds_list_create();
var sub_list = ds_list_create();
ds_list_add(sub_list, health);
ds_list_add(sub_list, lives);
ds_list_add(sub_list, score);
ds_list_add(j_list, sub_list);
ds_list_mark_as_list(j_list, 0);

The above code creates two ds_lists, then populates one with various values from global variables. This list is then added into the second list, and the position "marked" as such so that it can be correctly encoded later.

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