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- Pick a release from Pause-Games/flow releases and add its Source code (zip) URL (or a packaged
.zipasset, if the library ships one) togame.projectunder[project]dependencies, then Fetch Libraries in the Defold editor. - Run
bunx @defold-typescript/cli resolveto materialize its types. - Import it under a namespace alias of your choice:
import * as navigation_runtime from "flow.navigation.runtime"
- Pick a release from Pause-Games/flow releases and add its Source code (zip) URL (or a packaged
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 tableconfig?: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 tablemessage_id:Hash | string— The incoming message id hash, or raw string in test environmentsmessage?:LuaMap<string, unknown> | PlainTable— The incoming message payloadsender?:Url— The sender's msg.url() (unused, for Defold API compat)
Returns
boolean— True when the message was handled by navigation