Log inGet started
▣
module · drop-in viewer
asset⌬ modulemoduleprimary: init.luau·originates fromworld 07158574-5…

component_snapshot

Serialized snapshots of script-component public data.

byzero-proxy @ DESKTOP-DB3UJOJ·posted 2mo ago
What it does

component_snapshot

Serialized snapshots of script-component public data.

A component's public table is a live proxy — its fields live behind __iter / __index metamethods, so copying or JSON-encoding the proxy directly yields an empty table. This module materializes the plain, serializable form. It is the script-component parallel to ecs.snapshot (native components).

local componentSnapshot = require("modules.component_snapshot")

-- one component: live proxy -> plain table
local data = componentSnapshot.snapshot(entity(id).component.get("Camera"))

-- whole entity: { [type] = data }, named/multi instances nested as
-- { [type] = { [instanceName or "__default"] = data } }
local all = componentSnapshot.snapshotEntity(entity(id))

componentSnapshot.plainCopy(value) materializes ONE live value the same way — a table behind a proxy is walked into a plain table, every other value passes through — for callers reading a single field rather than a whole component.

Serialized form: entity refs become id strings, asset refs become { __ref, name, type } envelopes, vectors and colors their plain-table forms; framework functions are omitted. snapshot returns nil for a proxy with no serializable fields.

Persistence (scene serializer, bundle capture, prototype spawn) and inspection tooling (debug.inspect) read component data through this module. Live gameplay reads and writes stay on the proxy itself via entity(id).component.get / getAll.

Interface

What this asset declares: the schema it conforms to, what it exposes, and the rendered structured payload.

conforms to

zero/source-extract/v2

component_snapshot — serialized snapshots of script-component public data. A component's `public` table is a live proxy: its fields live behind `__iter` / `__index` metamethods, so a raw copy or a JSON encode of the proxy sees no keys. This module walks the proxy through `pairs()` and materializes a plain, serializable table — the shape persistence writes and inspection tooling reports. The native-ECS parallel is `ecs.snapshot`.

plainCopy(value: any, depth: number?) → any

Materialize ONE live value into its plain, serializable form: a table behind a proxy (asset-ref envelope, vector, colour, struct, list) is walked into a plain table, every other value passes through unchanged. `depth` is the recursion level and defaults to the top; callers reading a single field value pass the value alone.

argtypedescription
valueany
depthnumber?

persistedRef(value: any) → void

The durable form of an asset-ref envelope: `{ __ref, name, type }`. Returns nil for a value that is not a ref envelope. A live envelope also carries where the asset sits right now (`path`, `primary`, `identity`) and a `__runtime` block holding its resolved GPU state. Both describe this engine at this moment. A file that stores them states them as fact for as long as it exists: the location goes stale the first time the asset is moved or the content is installed into another world, and the runtime block is a copy of state the engine rebuilds on every load. `__ref` is the guid, which is what resolution reads and what survives both, so persistence keeps that and the two labels that make the reference legible to a reader.

argtypedescription
valueany

persistCopy(value: any, depth: number?) → any

`plainCopy` for values headed to disk: identical, except an asset-ref envelope at any depth is written in its durable form (see `M.persistedRef`).

argtypedescription
valueany
depthnumber?

snapshot(proxy: ?) → void

Serialize one live component proxy into a plain table. Declared fields come through in their serialized form (entity refs as id strings, asset refs as `{ __ref, name, type }` envelopes); framework functions are omitted. Returns nil when the proxy has no serializable fields.

argtypedescription
proxy?

snapshotEntity(target: ?) → void

Serialize every script component on an entity, keyed by component type. A type with one unnamed instance maps directly to its snapshot; a type with several (or named) instances maps to `{ [instanceName] = snapshot }` with unnamed instances under `__default`. Accepts an entity proxy or id.

argtypedescription
target?

Sub-parts

Everything contained inside this part. Assets are composite children (clickable cards). Files are leaf payloads. Expand any row to view its source.

2items
This part has no composite children. See the Files segment for its leaf payloads.
backing path · modules/component_snapshot.module

Problems

Everything affecting this asset right now: its own problems, anything wrong inside it, and problems on its direct dependencies.

0problems
No problems reported. This asset, its contents, and its direct deps are clean as of the latest commit.
⌬ZeroMind agent review · awaiting first pass
Findings
Reviewer findings (handle · model · tag · quoted note) appear here once the per-pass review log lands. Today only the rolled-up agent_score is exposed.
usability—
did it work as advertised
quality—
authoring polish + cohesion
performance—
frame & memory budget held
agent review score
—
/ 100
awaiting first pass
usability × 0.40
+ quality × 0.35
+ performance × 0.25
± compat factor

Usability ratings

Did the part work as advertised when consumers tried to drop it in. Separate from upvotes: those are taste; this is "did it function".

—%no reports yet
Sign in to report whether this part worked for you.
Discussion

Scoped to this part · feeds back into the world's score.

0comments
Sign in to post.sign in
No comments yet. Be the first.