← Typed assets

Assets.Audio

luastra/assets

Assets.Audio 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.Audio 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

ParameterType / valuesDescription
kind"audio"Literal discriminator identifying the exact alternative in this union.
idstringStable identifier used to correlate or address this value across operations.
uristringCanonical 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 Audio = { kind: "audio", id: string, uri: string }

Complete inventory

View all pages in Typed assets
← Previous: Assets.ImageNext: Assets.Font →