Navigation and routes

luastra/navigation

Maintains application-owned route history and optionally compiles typed route entries to canonical path and query locations. Named stacks, entry stacks, and browser-history integration remain explicit rather than hidden in the renderer.

Create the chosen stack once in module scope, mutate it in app.handle, and select the rendered screen from its current entry.

Use the compiler for deep links and visible URLs; use decideBack to resolve modal, local-stack, browser-history, and root-exit priority.

Complete example

local Navigation = require("luastra/navigation")

local routes = Navigation.create {
    routes = { "home", "game", "results" },
    initial = "home",
}

if routes.current() == "home" then
    routes.push("game")
end

local currentRoute = routes.current()

Detail pages

Navigation.SnapshotNavigation.RestoreErrorNavigation.RestoreResultNavigation.OptionsNavigation.StackNavigation.RouteErrorNavigation.RouteEntryNavigation.RouteResultNavigation.RouteCompilerNavigation.EntrySnapshotNavigation.MutationResultNavigation.EntryStackNavigation.decideBackNavigation.createNavigation.createRouterNavigation.compile