"Marks" a given ds_list position as being another ds_list.


GML Code Example

ds_list_mark_as_list(id, pos);

Argument Description
id The id of the list to mark.
pos The position within the list to mark.

Returns: 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.


GML Code Example

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.

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