Skip to Content
defold-typescript libraries
Pause-Gamesflow

Pause-Games/flow/flow.navigation.runtime

Flow navigation for a plain .script, such as a gameplay controller with a collection proxy.

  • GitHub: Pause-Games/flow — pinned to 1.0.0
    1. Pick a release from Pause-Games/flow releases and add its Source code (zip) URL (or a packaged .zip asset, if the library ships one) to game.project under [project] dependencies, then Fetch Libraries in the Defold editor.
    2. Run bunx @defold-typescript/cli resolve to materialize its types.
    3. Import it under a namespace alias of your choice:
      import * as navigation_runtime from "flow.navigation.runtime"

Functions

init(self: LuaMap<string, unknown> | PlainTable, config?: Flow_RuntimeConfig): LuaTable

Initialize navigation for a non-GUI script. Registers screens, optionally attaches the collection proxy runtime, and navigates to the initial screen if specified.

Stores state in self.navigation and self.navigation_runtime so it can be accessed from on_message() and cleaned up in final().

Parameters

  • self: LuaMap<string, unknown> | PlainTable — The .script self table
  • config?: Flow_RuntimeConfig — Configuration options

Returns

  • LuaTable — The navigation_runtime state table stored on self

final(self: LuaMap<string, unknown> | PlainTable)

Clean up the navigation runtime for a non-GUI script. Detaches the proxy runtime (if any) to remove event listeners. Call this from the .script final() lifecycle function.

Parameters

  • self: LuaMap<string, unknown> | PlainTable — The .script self table initialized by M.init()

on_message(self: LuaMap<string, unknown> | PlainTable, message_id: Hash | string, message?: LuaMap<string, unknown> | PlainTable, sender?: Url): boolean

Handle an incoming Defold message and route it to navigation. Delegates to navigation_messages.on_message() which dispatches push/pop/replace/reset/back/invalidate messages. Returns true when the message was consumed by navigation.

Parameters

  • self: LuaMap<string, unknown> | PlainTable — The .script self table
  • message_id: Hash | string — The incoming message id hash, or raw string in test environments
  • message?: LuaMap<string, unknown> | PlainTable — The incoming message payload
  • sender?: Url — The sender's msg.url() (unused, for Defold API compat)

Returns

  • boolean — True when the message was handled by navigation

On this page