Reads a queue data structure from a string.


ds_queue_read(id, str [, legacy]);

参数 描述
id The id of the data structure to read into.
str The string to read from.
legacy (optional) 可以是 truefalse 或完全省略。

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


With this function you can recreate a saved ds_queue (one that has previously been written as a string using ds_queue_write). You must first create a new ds_queue to read the string into, and if the ds_queue already exists and has information stored in it, then this will be cleared before reading. 在为游戏创建保存/加载机制时,此功能至关重要。请注意,如果数据结构是使用以前的版本创建的GameMaker你应该添加可选参数“legacy”,将其设置为true,因为此版本的字符串格式已更改。


queue = ds_queue_create();
var str = ini_read_string("Queues", "0", "");
if str != ""
   ds_queue_read(queue, str);

The above code creates a queue and stores the index in the variable "queue". 然后打开一个ini file并从中读取一个字符串,检查以确保该字符串不会先返回为空。This string is then read into the newly created ds_queue.

上一页: Queues
下一页: ds_queue_write
© Copyright YoYo Games Ltd. 2018 All Rights Reserved