Assets.Image
luastra/assetsAssets.Image is an exported, statically checked data contract of luastra/assets. Its exact declaration documents the fields or alternatives accepted at the module boundary and is erased after Luau analysis.
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
Asset types describe checked references and are erased after Luau analysis.
When to use it
Use Assets.Image when annotating values that cross the public luastra/assets boundary or when exporting helpers built on that module. The type documents the exact checked shape and prevents unrelated tables from being substituted accidentally.
Fields or definition
| Parameter | Type / values | Description |
|---|---|---|
| kind | "image" | Literal discriminator identifying the exact alternative in this union. |
| id | string | Stable identifier used to correlate or address this value across operations. |
| uri | string | Canonical host-neutral resource URI derived from the admitted asset. |
What happens next
A type-safe image, audio, font, or union reference.
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.
Exact declaration
export type Image = { kind: "image", id: string, uri: string }