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

scriptValidator

Per-file Luau / Lua script validator. Wraps `lsp.check(path)` to get the engine's embedded Luau LSP diagnostics — full parser pass + type check + every lint rule — and combines them with two cheap textual checks (`script.read_failed`, `script.empty`).

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

scriptValidator

Per-file Luau / Lua script validator. Wraps lsp.check(path) to get the engine's embedded Luau LSP diagnostics — full parser pass + type check + every lint rule — and combines them with two cheap textual checks (script.read_failed, script.empty).

Exports

  • M.validate(script, opts?) -> { Problem } — validate a single script entry ({ path, name } from vfsScanner).
  • M.validateBatch(scripts, opts?) -> { Problem } — flatten validation over a list.

opts is currently unused — reserved for future LSP option pass-through.

Checks performed

CodeSeverityWhat it catches
script.read_failederrorvfs.read returned nil for the file (deleted between scan and read, binary, or unreadable). When this fires, the LSP pass is skipped — there's no source to give it.
script.emptywarningThe file exists but has zero non-whitespace content.
lsp.<code>error / warning / infoForwarded from lsp.check. The LSP's stable diagnostic codes (parse-error, unknown-global, type-error, every lint code) are passed through verbatim under the lsp. prefix so callers can filter by them. Severity, line, column, message, and suggestion are taken from the diagnostic.

The path field on LSP-derived problems is augmented with :<line>:<col> so direct path-string editor jumps work.

Behaviour notes

  • The LSP runs in whatever mode the engine has it configured for — no per-script options are forwarded today. Run-once diagnostics include parse errors, type errors, and lint warnings the engine reports.
  • When lsp is not present in the Luau environment (e.g. a unit-test runner without the full engine), the script validator silently degrades to the read / empty checks only. The validator does not crash on missing globals.
  • File-level encoding / UTF-8 checks are not run here; the engine's source loader rejects invalid encodings before the validator sees them.

Removed (now real)

Earlier revisions of this module emitted placeholder.luau_syntax / placeholder.luau_typecheck info problems because no engine-side parser was exposed at runtime. Both are obsolete now that the embedded lsp.* namespace is available — the LSP delivers both syntax errors and type-check diagnostics in one pass.

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 ScriptValidator Per-file Luau / Lua script validator. Wraps `lsp.check` to on top of cheap textual sanity checks (read failure, empty file). require systems/worldValidation.package/scriptValidator about Each script gets the full LSP pass — `lsp.check(path, opts)` from the engine's embedded Luau LSP. Severity, line, column, code, and message are taken straight from the LSP and re-wrapped in the validator's `Problem` shape. The LSP diagnostics carry stable codes (`unknown-global`, `type-error`, `parse-error`, …) — we forward them verbatim so callers can `severity = "error"` or `code = "parse-error"` and get exactly the rows they expect. Two cheap textual checks run BEFORE the LSP is invoked: 1. `script.read_failed` (error) — `vfs.read` returned nil (file deleted between scan and read, or unreadable). 2. `script.empty` (warning) — zero non-whitespace content. These don't duplicate anything the LSP produces — the LSP is skipped when read fails (no source to feed it) and the empty check is informational about the file rather than the code.

safeRead(path: string) → string

argtypedescription
pathstring

makeProblem(severity: string, category: string, code: string, path: string, message: string) → void

argtypedescription
severitystring
categorystring
codestring
pathstring
messagestring

isAllWhitespace(s: string) → boolean

argtypedescription
sstring

lspSeverityToProblemSeverity(sev: string) → string

argtypedescription
sevstring

lspDiagnosticToProblem(diag: any, fallbackPath: string) → void

argtypedescription
diagany
fallbackPathstring

runLsp(path: string) → void

argtypedescription
pathstring

validate(script: ?, opts: ?) →

Validate a single script. Combines two cheap textual checks (`script.read_failed`, `script.empty`) with the embedded Luau LSP's full diagnostic pass via `lsp.check(path)`. path, message, placeholder = false }`. Empty array means no diagnostics fired.

argtypedescription
script?`{ path, name }` script entry from `vfsScanner`.
opts?Reserved for future use; currently ignored.

examples

local problems = ScriptValidator.validate({ path = "/source/foo.luau", name = "foo.luau" })

validateBatch(scripts: ?, opts: ?) →

Validate a batch of scripts and flatten the per-script problem lists into one array.

argtypedescription
scripts?Array of script entries from `vfsScanner`.
opts?Reserved for future use.

examples

local all = ScriptValidator.validateBatch(bucket.scripts)

Problems

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

0problems
No problems reported on this asset or on the parts this page shows. Parts it leaves out are not counted here.
⌬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.