Host.storageGet
luastra/hostHost.storageGet(name: string): RequestId
Starts an asynchronous read of the named host storage entry and returns a RequestId. Completion arrives in app.resolve with the stored string or a bounded failure code.
Before you use it
Add luastra/host to this module's dependencies in luastra.json, then import it with require("luastra/host"). Declare storage.get in luastra.json. Save the returned RequestId with its purpose and implement app.resolve.
How it fits
The function starts an asynchronous host request and returns immediately. app.resolve receives its success payload or stable failure code; availability and permission can vary by host.
When to use it
Use Host.storageGet during startup or on demand for small persisted application data. Record the RequestId before returning, distinguish missing data from other failures, and decode the payload before trusting it.
Parameters
| Parameter | Type / values | Description |
|---|---|---|
| name | string | Stable application-owned storage key to read. |
Returns
RequestId — an opaque request identifier used to correlate the asynchronous completion in app.resolve.
What happens next
A RequestId now, followed later by one matching app.resolve completion.
Failures and fixes
Undeclared capability, unavailable host support, denied permission, invalid input, deadline, network, or internal failure reaches the bounded failure path. Public completion codes are CANCELLED, DEADLINE, FORBIDDEN, INTERNAL, NETWORK, UNAUTHORIZED, and VALIDATION.
Availability
Public-source alpha capability API in 0.5.0-alpha; verify each claimed host independently.
Focused example
local Host = require("luastra/host")
local requestId = Host.storageGet("game-state")Continue with a complete recipe
This checked recipe uses Host.storageGet inside complete authored files with the required manifest, test, and run steps.
Open persist and restore state recipe