▣
module · drop-in viewer
document
A preset's `preset.yaml`: decoding it, reading it and writing it.
by·posted 2d ago
What it does
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) -> stringDocument.decode(body: string) -> DocDocument.read(ref) -> DocDocument.encode(envelope: Envelope, values) -> stringDocument.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)
Discussion
Scoped to this part · feeds back into the world's score.
Sign in to post.sign in
No comments yet. Be the first.