Host capabilities

luastra/host

Exposes bounded asynchronous capabilities supplied by the current host, including storage, clipboard, external launch, browser history, and system-Back decisions. Every request returns an opaque RequestId and completes through app.resolve.

Declare the corresponding capability in luastra.json, save each RequestId with its purpose, then validate the completion before changing application state.

Host support and user permission may vary, so a valid call is not proof of successful completion.

Complete example

local Host = require("luastra/host")

local pending: { [number]: string } = {}
local requestId = Host.storageGet("game-state")
pending[requestId] = "restore"

local function resolve(
    id: number,
    success: boolean,
    payload: string,
    _code: string,
    _message: string
)
    if pending[id] == "restore" and success then
        restoreGame(payload)
    end
    pending[id] = nil
end

Detail pages

Host.RequestIdHost.storageGetHost.storageSetHost.launchUrlHost.clipboardWriteHost.historyPushHost.historyReplaceHost.historyPushLocationHost.historyReplaceLocationHost.historyBackHost.historyCurrentHost.systemBackHandledHost.systemBackHistoryHost.systemBackExit