Reads the value from the top of the stack.


GML Code Example


Argument Description
id The id of the data structure to read from.

Returns: Real or String


This function will only read the first value of the stack (that which is "on top"). It will not pop the value, meaning that it can still be read in the future by this function or the ds_stack_pop.


GML Code Example

num = ds_stack_top(control_stack);

The above code will read the value from the stack indexed in the variable "control_stack" and store the return value in the variable "num".

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