🔤 getUIText(target)

📖 Description

Returns the current text of a UI element such as UIText, UIButton, or UIInputField. It accepts either the UI object itself or its name as a string.

🧠 Syntax

let text = getUIText(target);

📥 Parameters

NameTypeDescriptionDefault
targetobject|stringThe UI object or its name.

🔁 Return Value

TypeDescription
stringThe current text of the UI element.
nullReturned if the object doesn't exist or does not contain text.

✅ Basic Example

// Returns the text of the object named "LabelPoints"
let text = getUIText("LabelPoints");
console.log("Current text:", text);

🌈 Example Combined with setUIText()

// Increase a value displayed on screen
let value = parseInt(getUIText("LabelPoints")) || 0;
value++;
setUIText("LabelPoints", value);

🧠 Technical Details

💡 Tip:
Use getUIText() together with setUIText() to easily build counters, score displays, status panels, or dialogue systems.