ds_queue_destroy

Destroys a given queue and removes it from memory.

语法:

ds_queue_destroy(id);


参数 描述
id The id of the data structure to remove.


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


描述

This function will remove the given queue data-structure from memory, freeing up the resources it was using and removing all values that it contained. This function should always be used when you are finished using the ds_queue to prevent memory leaks that can slow down and crash your game.

IMPORTANT! When you create a data structure, the index value to identify it is an integer value starting at 0. This means that data structures of different types can have the same index value, so if in doubt you should be using the ds_exists function before accessing them. Also note that indices are re-used, so a destroyed data structure index value may be used by a newly created one afterwards so we recomend always setting the variable that held the DS index to -1 after destroying.


例如:

if lives = 0
   {
   ds_queue_destroy(AI_queue);
   AI_queue = -1;
   room_goto(rm_Menu);
   }

The above code will check the value of the built in global variable "lives" and if it is 0, it destroys the ds_queue indexed in the variable "AI_queue" and then changes rooms.


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