Skip to content

Input

This is the input class. It provides a text input field that can handle user input with various features likecursor movement, text manipulation, placeholder text, and input validation.

Extends: VisualElement

Properties

PropertyTypeDefaultDescription
textstring-The current text content of the input
cursorPosnumber1The current cursor position in the text
viewOffsetnumber0The horizontal scroll offset for viewing long text
placeholderstring...Text to display when input is empty
placeholderColorcolorgrayColor of the placeholder text
focusedBackgroundcolorblueBackground color when input is focused
focusedForegroundcolorwhiteForeground color when input is focused
cursorColornumbernilColor of the cursor
replaceCharstringnilCharacter to replace the input with (for password fields)

Functions

MethodReturnsDescription
Input:setCursor-Sets the cursor position and color
Input:updateViewportInputUpdates the input's viewport

Sets the cursor position and color

Parameters

  • x number The x position of the cursor
  • y number The y position of the cursor
  • blink boolean Whether the cursor should blink
  • color number The color of the cursor

Input:updateViewport()

Updates the input's viewport

Returns

  • Input self The updated instance

Released under the MIT License.