ds_stack_copy

Copies the contents of one stack to another.

Syntax:

GML Code Example

ds_stack_copy(id, source);


Argument Description
id The id of the NEW stack.
source The ORIGINAL stack to copy to id.


Returns: N/A


Description

This function can be used to copy the contents of one stack into another. Note that this does NOT remove the contents from the original stack, nor does it destroy the original stack. When using this function the stack being copied to must have been previously created and if it contained any items before the copy, then these will be cleared first (meaning this information will be lost).


Example:

GML Code Example

with (instance_create(x, y, obj_Enemy))
    {
    stack = ds_stack_create();
    ds_stack_copy(stack, other.stack);
    }
 

The above function creates a new instance and then in that instance it creates a new ds_stack and copies the contents of the stack in the instance running the code block, into the newly created instance stack.


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