Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commit8d45df8664

README.md

document

A preset's preset.yaml: decoding it, reading it and writing it.

The typed form names the declarer the values are for and the values:

target: { __ref: "<guid>", type: assetType, name: texture }
values:
  filter: nearest

target is written as a guid envelope, which the preset's .refs pins by guid; type and the target's plain name say what it points at to a person reading the file, and name is never an identity, so the guid is the one link. A target written as an identity string ("@builtin::assetTypes.texture", or a world asset's identity) is accepted on read. The component-only form, component: + properties:, reads as authored.

Exports

  • Document.pathOf(ref) -> string
  • Document.decode(body: string) -> Doc
  • Document.read(ref) -> Doc
  • Document.encode(envelope: Envelope, values) -> string
  • Document.write(ref, envelope: Envelope, values)

Types:

  • Envelope = { __ref: string, type: string?, name: string? }
  • Doc = { format: "typed" | "legacy", target: string?, envelope: Envelope?, component: string?, title: string?, values: { [string]: any } }

Usage

local Document = require("@builtin::modules.preset.document")
local doc = Document.read(presetRef)