CodeEditor
An experimental code-editing control. Styling and host admission have their own limits; do not assume the complete planned editor is available.
Advanced app/host integration API. Useful for lower-level work; ordinary app authors can start with the app-building path. This is public API, not permission to access private toolkit objects.
Create: Instance.new("CodeEditor", {...}). Inherits: TextBox.
Parent and children: Use Window, Frame or ScrollingFrame as the Parent. It does not accept visual child content.
Example
Section titled “Example”Experimental editor. This demonstrates plain editing, not syntax highlighting or execution of the typed code.
Where to put it: replace Src/Main.luau in a project created with this SDK. This is the complete entry file.
local Window = Instance.new("Window", { Title = "LUI example", Size = UDim2.fromOffset(560, 280),})local Status = Instance.new("TextLabel", { Parent = Window, Text = "Ready", Position = UDim2.fromOffset(16, 170), Size = UDim2.new(1, -32, 0, 72),})local Editor = Instance.new("CodeEditor", { Parent = Window, Text = 'print("Hello")', Size = UDim2.fromOffset(520, 130), Position = UDim2.fromOffset(16, 16),})Editor.TextChanged:Connect(function() Status.Text = "Text revision: " .. Editor.TextRevisionend)local Styled = Editor:SetStyles(Editor.TextRevision, {{Start = 0, End = 5, Color = 0x3366CC}})assert(Styled == false) -- Public styling is not admitted in this SDK.Window.Visible = trueExpected result: A plain multiline editor appears. Editing advances TextRevision. The example deliberately shows the current refusal of public styling.
Behavior and limits
Section titled “Behavior and limits”- Plain multiline editing is available, but SetStyles returns false in this SDK. Do not build a syntax-highlighting requirement on the reflected signature.
- Its text limit is 262,144 UTF-8 bytes. TextBox has the smaller 65,534-byte limit. Physical input-method and accessibility qualification remains platform-specific.
Properties
Section titled “Properties”Multiline
Section titled “Multiline”Always true for CodeEditor; it cannot be reassigned.
Type: boolean. Default: true; immutable. Read-only.
Secret
Section titled “Secret”Always false for CodeEditor. Use TextBox for secret entry.
Type: boolean. Default: false; immutable. Read-only.
MaxLength
Section titled “MaxLength”Scalar limit within the editor’s 262,144-byte UTF-8 ceiling. The larger limit does not remove execution or memory quotas.
Type: number. Default: 262144 Unicode scalars; UTF-8 byte ceiling also 262144. Read/write field.
TextRevision
Section titled “TextRevision”Revision number that advances when committed text changes. Use it to avoid applying work based on older text.
Type: number. Default: 1; advances when committed text changes. Read-only.
Methods
Section titled “Methods”SetStyles
Section titled “SetStyles”Accepts a text revision and zero-based scalar ranges with packed RGB colors. Public styling is currently refused with false in this SDK; use plain editing rather than assuming syntax highlighting works.
SetStyles(ExpectedRevision: number, Ranges: {{Start: number, End: number, Color: number}}) -> booleanInherited members
Section titled “Inherited members”You can use these directly on CodeEditor. Follow a member link for its explanation and example.
From TextBox
Section titled “From TextBox”Text · Enabled · Multiline · Secret · PlaceholderText · MaxLength · SelectionStart · SelectionLength · IsComposing · CompositionText · TextChanged · SelectionChanged · CompositionStarted · CompositionChanged · CompositionEnded
From GuiObject
Section titled “From GuiObject”Visible · AccessibilityLabel · AccessibilityDescription · Size · Position · AnchorPoint · LayoutOrder · BackgroundColor3 · BackgroundTransparency · BorderColor3 · BorderSizePixel · CornerRadius · Opacity · TextColor3 · TextSize · FontFamily · FontWeight · TextWrapped · TextXAlignment · TextYAlignment · ZIndex · ClipsDescendants · IsFocused · AbsolutePosition · AbsoluteSize · Focus · Focused · FocusLost · MouseEnter · MouseLeave · InputBegan · InputChanged · InputEnded
From Instance
Section titled “From Instance”Name · Sensitive · EffectiveSensitive · Parent · ClassName · Destroy · Clone · GetChildren · GetDescendants · FindFirstChild · IsA · Changed · Destroying
Full type declaration — for type checking and deeper reference
The declaration is generated from the SDK. Self is supplied by a colon call; read means the field cannot be assigned. See how to read this reference.
export type CodeEditor = TextBox & { read Multiline: boolean, read Secret: boolean, MaxLength: number, read TextRevision: number, read SetStyles: (Self: CodeEditor, ExpectedRevision: number, Ranges: {{Start: number, End: number, Color: number}}) -> boolean,}Availability and deeper reading
Section titled “Availability and deeper reading”See platform limits before relying on host-specific behavior. The framework design specification and reflection/type sources are deeper engineering references, not extra setup required to build an app.