Assets.uri
luastra/assetsAssets.uri(value: Reference): string
Returns the canonical asset URI carried by a typed Image, Audio, Font, or general Reference. The URI is host-neutral and points only to a resource already admitted by the project manifest.
Before you use it
Add luastra/assets to this module's dependencies in luastra.json, then import it with require("luastra/assets"). Declare the referenced file in luastra.json with its stable asset id and admitted media type. Image assets are PNG, JPEG, WebP, or AVIF; audio assets and WOFF2 fonts use their own declared types.
How it fits
The constructor validates an asset id and returns a typed reference synchronously. It does not read a file. Assets.uri exposes the packaged asset URI for a consuming UI or Media API.
When to use it
Use Assets.uri at the final SDK boundary that expects a URI string, such as UI.Image.source or a media queue item. Keep the typed reference until that boundary so asset kinds remain checked for as long as possible.
Parameters
| Parameter | Type / values | Description |
|---|---|---|
| value | Reference | Typed asset reference whose canonical host-neutral URI is required. |
Returns
string — the validated canonical string produced by this operation.
What happens next
A checked reference or canonical asset URI that a compatible API can consume.
Failures and fixes
A malformed id, missing manifest entry, wrong media kind, unsupported media type, or missing source file fails during project checking or packaging. Assets.font can be applied through UI.TextStyle in the 0.3 source SDK. A missing or wrong-kind font fails when the rendered tree resolves its asset; a failed browser font decode/load retains the selected fallback.
Availability
Public-source alpha API in 0.5.0-alpha; supported consumers vary by asset kind.
Focused example
local Assets = require("luastra/assets")
local source = Assets.uri(Assets.audio("audio/intro"))Continue with a complete recipe
This checked recipe uses Assets.uri inside complete authored files with the required manifest, test, and run steps.
Open package an image and compose visuals recipe