Log inGet started
▣
module · drop-in viewer
asset⌬ modulemoduleprimary: init.luau·part ofpackage zerojs.package·originates fromworld f63c1fe3-4…

bridge

Marshaling between Luau host values and a realm's JavaScript value model.

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

bridge

Marshaling between Luau host values and a realm's JavaScript value model.

bridge.toJs(rt, luauValue) lifts a Luau value into JS; bridge.toLuau(rt, jsValue) lowers a JS value back into Luau. Numbers, strings and booleans pass through both ways. Luau nil becomes values.undefined; values.undefined becomes nil and values.null returns the sentinel itself. A dense integer-keyed Luau table becomes a 0-based JS array; any other plain table becomes a JS object. Luau functions become JS functions (and vice versa), calling back across the boundary with arguments and return values marshaled. Tables carrying a metatable and userdata are opaque host handles, wrapped in a private JS field and unwrapped back to the original on the return trip, so values like AssetRefs survive round trips. Both directions are deep and cycle-safe: a per-call seen-map yields one result container per source container.

Interface

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

conforms to

zero/source-extract/v2

strict

isArrayLike(t: { [any]: any }) → boolean

argtypedescription
t{ [any]: any }

isPlainTable(v: any) → boolean

A plain data table carries no metatable. Tables with a metatable (AssetRefs, class instances, sentinels) are opaque host values passed through unchanged.

argtypedescription
vany

isObject(v: any) → boolean

argtypedescription
vany

stripChunkPrefix(text: string) → string

Strip a leading Luau chunk-position prefix (`<chunkname>:<line>: `) from a host error's rendered text, so the JS Error carries only the raised message. The chunkname is any run of non-whitespace up to the first `:<digits>: `.

argtypedescription
textstring

makeHostError(rt: any, detail: string) → any

Build the JS Error a failed host call surfaces from the raised Luau detail. The message is the detail with its chunk-position prefix stripped; the full detail is preserved under a non-enumerable `luauDetail`. The same error object backs both the synchronous throw path and the promise-rejection path, so a host failure reads identically whether or not the call yielded first.

argtypedescription
rtany
detailstring

wrapHandle(rt: any, v: any) → any

Wrap an opaque Luau host value (userdata, or a table with a metatable) as a JS object carrying it in a private, non-enumerable field. `toLuau` unwraps it back to the original, so host handles survive a round trip by identity.

argtypedescription
rtany
vany

unwrapHandle(rt: any, obj: any) → void

argtypedescription
rtany
objany

toJs(rt: any, v: any, seen: { [any]: any }?) → any

Marshal a Luau value into the realm's JS value model.

argtypedescription
rtany
vany
seen{ [any]: any }?

call(_rt: any, _this: any, args: { any }) → void

argtypedescription
_rtany
_thisany
args{ any }

deliver( ) → void

Deliver the fn's completion. When the call took the sync path no promise exists and this is a no-op beyond recording state; when the call yielded, the promise fulfils with the marshaled value or rejects with the structured host error, and the loop's in-flight host-call count is balanced.

toLuau(rt: any, v: any, seen: { [any]: any }?) → any

Marshal a JS value back into a Luau host value.

argtypedescription
rtany
vany
seen{ [any]: any }?

toTable( ) → void

Sub-parts

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

3items
This part has no composite children. See the Files segment for its leaf payloads.
backing path · zerojs.package/bridge.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.