Navigation.EntryStack
luastra/navigationNavigation.EntryStack is a stateful navigation contract that owns route history or translates between route entries and canonical locations. Its public methods validate mutations and return bounded results instead of exposing internal tables.
Before you use it
Add luastra/navigation to this module's dependencies in luastra.json, then import it with require("luastra/navigation"). No host capability is required for in-memory navigation. Browser URL/history synchronization additionally needs luastra/host and navigation.history.
How it fits
The type describes a route, stack, compiler, or checked result used by navigation operations.
When to use it
Use Navigation.EntryStack as long-lived application state when navigation must survive repeated renders. Create it once, mutate it through its public methods, and render from its current route rather than rebuilding it on every render.
Fields or definition
| Parameter | Type / values | Description |
|---|---|---|
| current | () -> RouteEntry | Callable current member exposed by Navigation.EntryStack; invoke it through the owning contract rather than replacing internal state. |
| currentLocation | () -> string | Callable currentLocation member exposed by Navigation.EntryStack; invoke it through the owning contract rather than replacing internal state. |
| canBack | () -> boolean | Callable canBack member exposed by Navigation.EntryStack; invoke it through the owning contract rather than replacing internal state. |
| push | (entry: any) -> MutationResult | Callable push member exposed by Navigation.EntryStack; invoke it through the owning contract rather than replacing internal state. |
| pushLocation | (location: string) -> MutationResult | Callable pushLocation member exposed by Navigation.EntryStack; invoke it through the owning contract rather than replacing internal state. |
| replace | (entry: any) -> MutationResult | Callable replace member exposed by Navigation.EntryStack; invoke it through the owning contract rather than replacing internal state. |
| replaceLocation | (location: string) -> MutationResult | Callable replaceLocation member exposed by Navigation.EntryStack; invoke it through the owning contract rather than replacing internal state. |
| back | () -> boolean | Callable back member exposed by Navigation.EntryStack; invoke it through the owning contract rather than replacing internal state. |
| snapshot | () -> EntrySnapshot | Callable snapshot member exposed by Navigation.EntryStack; invoke it through the owning contract rather than replacing internal state. |
| encode | () -> string | Callable encode member exposed by Navigation.EntryStack; invoke it through the owning contract rather than replacing internal state. |
| restore | (snapshot: any) -> RestoreResult | Callable restore member exposed by Navigation.EntryStack; invoke it through the owning contract rather than replacing internal state. |
| restoreEncoded | (value: string) -> RestoreResult | Callable restoreEncoded member exposed by Navigation.EntryStack; invoke it through the owning contract rather than replacing internal state. |
What happens next
A checked route/navigation annotation.
Failures and fixes
Invalid definitions, unknown routes, malformed parameters, excessive history depth, or incompatible snapshots return bounded errors or fail construction. Navigation result records use success:boolean with optional fields, so verify the field you need after checking success.
Availability
Public-source alpha API in 0.5.0-alpha; URL integration is a separate host capability.
Exact declaration
export type EntryStack = {
current: () -> RouteEntry,
currentLocation: () -> string,
canBack: () -> boolean,
push: (entry: any) -> MutationResult,
pushLocation: (location: string) -> MutationResult,
replace: (entry: any) -> MutationResult,
replaceLocation: (location: string) -> MutationResult,
back: () -> boolean,
snapshot: () -> EntrySnapshot,
encode: () -> string,
restore: (snapshot: any) -> RestoreResult,
restoreEncoded: (value: string) -> RestoreResult,
}