EventStack

Ashley's avatar
Medal
Construct Team Founder
Published 2 Jul, 2018
163 words
<1 min

The EventStack class represents the execution stack in the event system. It is analogous to the stack in traditional programming languages, but adapted to the event system. For example triggering an event will push a new event stack frame, run the trigger, pop the event stack frame, and then resume from the calling event. This ensures each level of execution in the event system runs with its own context.

In Construct the main purpose of the event stack is to track the current event. The event stack is accessible via EventSheetManager's GetEventStack() method.

Methods

GetEventSheetManager()

Return the associated EventSheetManager.

GetRuntime()

Return the associated Runtime.

GetCurrentStackFrame()

Return the current EventStackFrame.

Push(currentEvent)

Push a new EventStackFrame to the event stack, and return it. The initial current EventBlock for the new stack frame must be passed to this call. Every push must have a corresponding Pop call.

Pop()

Pop the top EventStackFrame from the event stack. This must be called after every Push call.