Skip to content

Search documentation

Enter at least two characters.

    AssetService

    SDK 0.1.0-preview.1 · ExperimentalDownload & release notes ↗

    Checks whether an asset name was declared. ImageLabel selects that name for asynchronous decoding; this service has no public Load method.

    No additional capability token. This service is available through the runtime; individual feature results still depend on the selected host.

    The host is the program running your Luau code: normally the SDK’s native runner. Its provider/adapter implements an optional service. You do not need to write one to use a service already supplied by the SDK. Capabilities explains the manifest and remaining platform limits.

    Where to put it: replace Src/Main.luau in a project created with this SDK. This is the complete entry file.

    Asset setup: declare Pixel.png in Assets and include the files. The complete image recipe supplies the asset.

    local Window = Instance.new("Window", {
    Title = "LUI example", Size = UDim2.fromOffset(560, 280),
    })
    local Status = Instance.new("TextLabel", {
    Parent = Window, Text = "Ready", Position = UDim2.fromOffset(16, 170),
    Size = UDim2.new(1, -32, 0, 72),
    })
    local Assets = app:GetService("AssetService")
    Status.Text = if Assets:Has("Pixel.png") then "Image declared" else "Image not declared"
    Window.Visible = true

    Expected result: Reports whether Pixel.png is declared, without pretending that declaration means decoding is complete.

    For source, manifest, pin and assets together, use the complete practical recipe.

    Returns whether the exact asset name is declared. true does not mean an image has finished decoding; inspect ImageLabel.LoadState for that.

    Has(Name: string) -> boolean
    Full type declaration — for type checking and deeper reference

    The declaration is generated from the SDK. Self is supplied by a colon call; read means the field cannot be assigned. See how to read this reference.

    export type AssetService = {
    read Has: (Self: AssetService, Name: string) -> boolean,
    }

    See platform limits before relying on host-specific behavior. The framework design specification and reflection/type sources are deeper engineering references, not extra setup required to build an app.