โ† All examples

godot components

Pushdown state stack for screens and modal states

Keep a stack of state objects where only the top runs: pushing pauses the state below, popping resumes it, replace swaps the top, and pop_to unwinds several levels. Use it for pause menus and nested screens.

What this component contains

  • ATTRIBUTION.md
  • LICENSE
  • README.md
  • baltor_test.gd
  • component.json
  • inspect_gdscript.py
  • pushdown_automaton.gd
  • run_tests.gd
  • test_package.py
  • tests/test_pushdown_automaton.gd
  • verification/native.json

How it works

Class
BaltorStateStack, extends Node
Methods
push(state: Object, data: Dictionary = {}) -> bool; pop() -> Object; replace(state: Object, data: Dictionary = {}) -> bool; pop_to(state: Object) -> bool; clear() -> void; peek() -> Object; depth() -> int; contains(state: Object) -> bool; and 1 more
Signals
pushed, popped, top_changed
Exports
max_depth, update_all
Placement
res://baltor/godot_components/pushdown_automaton/

Recorded checks

godot 4.7.2.stable.official.ed1daf0bf

  • godot_parse_check_only
  • godot_gdscript_tests
  • godot_tests_reject_gutted_component
  • godot_editor_import
  • godot_contract_reflection
  • godot_readme_usage_compiles

Limits to consider

States are plain objects found by the methods they define; the stack holds references and does not free them. Callbacks run synchronously in push and pop order. Verified with Godot 4.7.2 headless; written against the Godot 4.3 API.