import{_ as t,c as e,o as i,a4 as s}from"./chunks/framework.nQaBHiNx.js";const x=JSON.parse('{"title":"Textfield","description":"","frontmatter":{"outline":"deep"},"headers":[],"relativePath":"references/textfield.md","filePath":"references/textfield.md","lastUpdated":null}'),a={name:"references/textfield.md"},l=s(`
Textfields are objects that allow users to write text in multiple lines, similar to the default edit script.
| Property | Type | Description |
|---|---|---|
| lines | table | A collection of strings, where each string represents a separate line in the Textfield. |
| lineIndex | number | The current line number where the cursor is positioned. |
| scrollIndexX | number | The horizontal scroll position, determining which part of the text is visible when the text width exceeds the Textfield width. |
| scrollIndexY | number | The vertical scroll position, deciding which part of the text is visible when the number of lines exceeds the Textfield's height. |
| cursorIndex | number | The current position of the cursor within the line determined by lineIndex. |
Here’s a simple example showcasing how to instantiate a Textfield object within the Basalt framework:
local main = basalt.createFrame()
local aTextfield = main:addTextfield()
-- User writes text into the Textfield
-- ...
-- Retrieve the text from the Textfield
local allText = table.concat(aTextfield.lines, "\\n")
basalt.debug(allText)