fieldEdits.module
This package holds more than this page lists. See all of its files in its world.
README.md
Field edits
Scene authoring uses FieldEdits to keep structured field intent separate from generated data. Each edit carries a path, the value that field was based on, and the authored value, with explicit presence flags for additions and removals.
local Fields = require("@builtin::modules.fieldEdits")
local base = {position={0,0,0}, light={intensity=1}}
local visible = {position={2,0,0}, light={intensity=1}}
local edits = Fields.diff(base, visible)
local rebuilt = Fields.compose({position={0,0,0}, light={intensity=3}}, edits)
assert(not rebuilt.blocked)
assert(rebuilt.value.position[1] == 2)
assert(rebuilt.value.light.intensity == 3)
copy(value)validates and copies structured data without sharing mutable tables.diff(before, after)creates deterministic field edits. Objects merge by string key; arrays and asset references are atomic values.compose(generated, edits)applies authored values and reports divergence from their stored baseline. Missing parents, missing edited targets and conflicting root additions block the result. Satisfied paths identify intent the generated value already matches.update(generated, previous, current, edits)records a new authoring operation while retaining existing baselines and satisfied intent. An addition followed by its removal cancels that addition.updateChanges(generated, current, changes, edits)records original observed changes against their merged visible result. A change already satisfied by the current generated value remains an authored intent for subsequent builds.keep(generated, edits, paths?)acknowledges reviewed generated changes while retaining the authored values at the selected exact paths.
Inputs are copied, edit paths are non-overlapping dense arrays of strings, and values are finite serializable data with bounded nesting. Scene-level hierarchy, reference and component validation belongs to the scene composer consuming these field results.