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

controls

edui's own interactive controls, drawn on the `ui.*` canvas substrate (paint commands + pointer/key/scroll events) rather than the generic `ui.*` widgets, so an editor control looks and behaves like an editor control and enforces its type.

by◐lumi·posted 19d ago
What it does

edui.widgets.controls

edui's own interactive controls, drawn on the ui.* canvas substrate (paint commands + pointer/key/scroll events) rather than the generic ui.* widgets, so an editor control looks and behaves like an editor control and enforces its type.

Controls.make(W) binds them to the widgets barrel and returns:

  • numberField(P, o) — a numeric field that only ever holds a number. Drag the value to scrub, scroll to nudge, double-click to type digits (letters can't enter); an optional ▲▼ stepper sits on the right. o = { value, onChange, key, readOnly, width?, stepper? }.
  • boolToggle(P, o) — a pill/knob toggle switch, distinct from a checkbox. o = { value, onChange, key, readOnly }.

Canvas paint points are POSITIONAL {x, y} arrays. Interaction payloads arrive as the value the edui app unwraps from the engine event envelope (d.dx/d.dy for drag/scroll).

Interface

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

conforms to

zero/source-extract/v2

module edui.widgets.controls edui's OWN interactive controls, drawn on the `ui.*` canvas substrate (paint commands + pointer/key/scroll events) rather than the generic `ui.*` widgets — so an editor control looks and behaves like an editor control, independent of general UI, and enforces its type. A number is a drag-scrub field that only ever holds a number (drag to scrub, scroll to nudge, double-click to type digits — letters can't enter); a bool is a toggle switch. `Controls.make(W)` binds them to the widgets barrel.

fmtNum(v: any) → string

argtypedescription
vany

acceptNumeric(buf: string, key: string) → string

Is `key` a character we allow into a numeric buffer?

argtypedescription
bufstring
keystring

make(W: any) → any

Bind the canvas controls to the widgets barrel `W`. Returns `{ numberField, boolToggle }`.

argtypedescription
Wany

numberField(P: any, o: any) → any

argtypedescription
Pany
oany

stepAmount(d: any) → number

argtypedescription
dany

boolToggle(P: any, o: any) → any

A bool toggle switch (pill + knob), distinct from a checkbox.

argtypedescription
Pany
oany

Sub-parts

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

10items
▣
module · born here
❒asset
# json_utils Safe JSON decoding helpers and a WASM-safe number formatter. Wraps `Json.decode` with `pcall` so engine-provided JSON strings can't propagate parse errors into call sites. Also handles the engine convention of writing the literal string `"null"` when a JSON value is absent. ## Exports - `M.decodeOrNil(jsonStr: string?) -> any` — safe decode; returns `nil` on empty input, `"null"`, or parse failure. - `M.decodeOrEmptyTable(jsonStr: string?) -> table` — safe decode; returns `{}` on any failure or non-table result. - `M.safeDecode(jsonStr: string?) -> any` — historical alias for `decodeOrNil`. - `M.formatNumber(n: number, decimals?: number) -> string` — truncate a number to N decimal places using only string ops. WASM-safe. ## Usage ```luau local JsonUtils = require("@builtin::modules.json_utils") local payload = JsonUtils.decodeOrNil(engineJsonString) local table = JsonUtils.decodeOrEmptyTable(maybeMissing) local label = JsonUtils.formatNumber(3.14159, 2) -- "3.14" ``` ## Notes - `decodeOrNil` short-circuits on `nil`, empty string, and the literal string `"null"`. The Json.decode call itself is wrapped in `pcall`, so malformed input is never observable to callers. - `decodeOrEmptyTable` is intentionally strict: non-table decode results (numbers, strings, booleans, nil) collapse to `{}`. Use `decodeOrNil` if you need to distinguish those. - `formatNumber` uses `tostring` + `string.sub` so it avoids the `string.format` numeric specifiers that don't work reliably under WASM in Luau. Pass `decimals = 0` to drop the fractional part entirely; a count below `0` reads the same as `0`, and a fractional count counts the whole places in it. - `formatNumber` truncates the mantissa of a value `tostring` renders in exponent form (`1.5e-07`) and keeps the exponent, so the result still reads back through `tonumber`.
▲ 0↑ born
·
other · born here
▤file
▲ 0↑ born
▣
module · born here
❒asset
# json JSON encode/decode library for Luau. Encodes Lua values to JSON strings and decodes JSON strings back to Lua values. Used for communication with the Rust side of the engine, the VFS read/write bridge, and any wire-format that needs JSON. Pure Luau, no engine dependencies. Compact and pretty-printed encoders, plus a hand-rolled decoder that streams the input by position so it works under WASM as well as native. ## Exports - `Json.encode(value: any, indent?: string, currentIndent?: string) -> string` — compact encode. Functions / unknown types and NaN/Inf encode as `null`. - `Json.encodePretty(value: any, indentStr?: string) -> string` — pretty-printed encode with sorted object keys (diff-friendly). - `Json.encodeArgs(...: any) -> string` — encode varargs as a JSON array. - `Json.decode(str: string) -> any` — decode a JSON string. Returns the decoded value, or `nil` + error message on failure. ## Usage ```luau local Json = require("@builtin::modules.json") local widget = { type = "button", text = "Click Me" } local compact = Json.encode(widget) -- '{"text":"Click Me","type":"button"}' local pretty = Json.encodePretty(widget, " ") local decoded = Json.decode(compact) local v, err = Json.decode("oops") -- v = nil, err = error message ``` ## Notes - Object keys are sorted alphabetically in both encoders for consistent output across runs. - Numeric keys on objects are stringified at encode time (JSON has no numeric keys). Pure-integer key sets get detected as arrays via `isArray` and encoded with brackets. - NaN, +Inf, -Inf encode as `null` — JSON has no representation. Round trips through `decode` recover `null` (Lua `nil`), so they don't preserve. - Unicode `\uXXXX` escapes decode to UTF-8 by hand to stay WASM-safe. Only the BMP is covered; supplementary planes via surrogate pairs are not. - Functions encode as `null`. - Decode is character-streamed — no regex, no `string.match` patterns on the whole input — so the line-and-column information needs to be reconstructed from the position offset.
▲ 0↑ born
·
other · born here
▤file
▲ 0↑ born

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.