ds_stack_destroy

Destroys a given stack and removes it from memory.

Syntax:

ds_stack_destroy(id);


Argument Description
id The id of the data structure to remove.


Returns: N/A


Description

This function will remove the given stack 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_stack to prevent memory leaks that can slow down and crash your game.


Example:

if lives = 0
   {
   ds_stack_destroy(AI_stack);
   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_stack indexed in the variable "AI_stack" and then changes rooms.


Back: Stacks
Next: ds_stack_clear
© Copyright YoYo Games Ltd. 2018 All Rights Reserved