ds_stack_size

Returns the number of values stored in the given stack.

Syntax:

GML Code Example

ds_stack_size(id);


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


Returns: Real


Description

This function will return the "size" of the stack, ie: the number of items that have been pushed onto it.


Example:

GML Code Example

if !ds_stack_empty(control_stack)
    {
    num = ds_stack_size(control_stack);
    }
 

The above code checks a ds_stack to see if it is empty or not, and if it is not, it gets the number of items that it contains and stores the value in a variable.


Back: Stacks



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