A tiny double-stacked state manging library for Lua/LÖVE
St8 keeps two Stacks of States:
Movement ^ Input State | secondary stacks Menu - Game - Pause Menu Overlay | ---------------primary stack--------------->
All States in the currently active Stack will run in parallel (i.e. receive events)
st8.lua to and keep the return value around.
hook() to hook
st8.lua up to the LÖVE handlers/callbacks.
order(event, order) the execution order for a single event can be changed, pass anything but
"bottom-up" to execute the events top-down.
The bottom-up order is recommended for example for the
You can add and remove Stacks (elements on the primary stack) using
You can add and remove States (elements on the secondary stack) using
You can swap States using
swap(old, new) and remove a specific State using
All methods accept additional arguments, these will be passed on both to the last State(s) and the new ones.
pause accepts lists or single States as arguments.
St8 covers all of LÖVE's callbacks.
Event callback methods receive one additional parameter (as the first one).
This is the return value of the State above the one receiving the event currently; For the topmost State it will always be
The return value of the last State of the current Stack will be returned.
This can be used to pass messages between States of a Stack.
You can find a small example showing off some of the features in the