bridge
Marshaling between Luau host values and a realm's JavaScript value model.
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.
Scoped to this part · feeds back into the world's score.