What it does
script_introspect
Script debugging / introspection helpers — tiered detail levels for
inspecting registered component types. Uses component.list(),
component.getSource(), and component.getInfo() as data sources,
then parses source text in Luau to extract header comments, public
properties (public.propName = value), and public functions
(function public.name / function public:name).
Exports
M.extractHeader(source: string) -> string— opening comment block (strips--prefixes, skips--!/--@diagnosticdirectives).M.extractProperties(source: string) -> { PropertyInfo }—public.*field decls with default value + trailing comment.M.extractFunctions(source: string) -> { FunctionInfo }—public.*/public:*function decls (with or withouttyped).M.getInfo(name: string, level: number?) -> ComponentInfo?— level 1 = metadata + header, 2 = +API, 3 = +source.M.listTypes() -> { ComponentInfo }— every registered component (metadata only, no source parse).
Types:
PropertyInfo = { name: string, default: string, comment: string }FunctionInfo = { name: string, params: string }ComponentInfo = { name: string, builtin: boolean?, executionOrder: number?, description: string?, properties: { PropertyInfo }?, functions: { FunctionInfo }?, source: string? }
Usage
local Introspect = require("@builtin::modules.engine.editor.script_introspect")
for _, info in ipairs(Introspect.listTypes()) do
print(info.name, info.builtin)
end
local detail = Introspect.getInfo("Transform", 2)
Notes
- Source parsing is regex-based and best-effort —
extractFunctionsmatches the canonicaltyped function public.name(args)shape plus the bare-functionvariants, but unusual layouts can slip through. listTypesis intentionally metadata-only — pulling source for every component would be expensive when the caller only wants a list.
Discussion
Scoped to this part · feeds back into the world's score.
Sign in to post.sign in
No comments yet. Be the first.