Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commit61a33237e0

README.md

assetType.shared.typeYaml

A type's type.yaml, parsed. Every block a type declares in its type.yaml (settings:, inspector:) is read through this module, so one file read and one YAML decode serve all of them.

local TypeYaml = require("@builtin::assetTypes.assetType.shared.typeYaml")

local folder, identity = TypeYaml.folder("material")
-- "/zero/source/libs/@builtin/assetTypes/material.assetType", "@builtin::assetTypes.material"

local doc = TypeYaml.of("material")
print(doc.suffix)            -- ".material"
print(doc.inspector.type)    -- "inspector.luau"
  • TypeYaml.folder(typeName) resolves the assetType and answers its folder path and identity, or (nil, nil) when no such type resolves.
  • TypeYaml.of(typeName) answers the decoded document, or nil when the type does not resolve or its type.yaml does not decode to a table. The decode is cached per type and read again whenever the file's content version moves, or the type resolves to a different folder.
  • TypeYaml.described(typeName) lists the files a type's assets must describe: each file its type.yaml declares with a described content check, with the keys and headings the check names and each key's byte limit. TypeYaml.PLACEHOLDER is the marker a template puts where a description is yet to be written.
  • TypeYaml.describeBlock(typeName) answers the describe: block of the type.yaml: the type's own guidance on what a description covers and the identities of examples whose descriptions show the shape.