← Dynamic content

Content.PickResult

luastra/content

Content.PickResult is a discriminated union covering successful output and bounded failure. Branching on success narrows the value to the correct exported record and makes error handling explicit.

Before you use it

Add luastra/content to this module's dependencies in luastra.json, then import it with require("luastra/content"). Declare content.pick for browser selection and content.upload for transfer. Upload requires a server-created intent from an authenticated declared backend function. Application code must never construct a provider URL, file path, data URL, blob URL, bucket path, or upload handle.

How it fits

Content types describe checked ephemeral image references and asynchronous selection/upload results; they are erased after Luau analysis.

When to use it

Use Content.PickResult at the boundary where untrusted or versioned input is decoded. Branch on result.success before reading value or error so both outcomes remain explicit and type-safe.

Fields or definition

ParameterType / valuesDescription
definitionPickSelected | PickCancelledExact alias, union, or callable contract represented by Content.PickResult.

What happens next

A type-safe dynamic image, selection, transfer, or progress annotation.

Failures and fixes

Cancellation, malformed or expired handles, unsupported media types, excessive bytes or dimensions, offline transfer, authorization denial, and decode failure remain explicit branches. Release previews, request fresh display grants after UI.Image.onError, and never persist or log upload/content handles.

Availability

Private source foundation after 0.5.0-alpha; browser PNG/JPEG selection and upload are automated, while camera and native picker certification remain later evidence gates.

Exact declaration

export type PickResult = PickSelected | PickCancelled

Complete inventory

View all pages in Dynamic content
← Previous: Content.PickCancelledNext: Content.UploadProgress →