🔤 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
| Name | Type | Description | Default |
target | object|string | The UI object or its name. | — |
🔁 Return Value
| Type | Description |
string | The current text of the UI element. |
null | Returned 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
- Compatible with
UIText, UIButton and UIInputField objects.
- If the parameter is a string, the function searches the object using
getObjectByName().
- Returns
null if the object doesn't exist or is not a UI type containing text.
💡 Tip:
Use getUIText() together with setUIText() to easily build counters,
score displays, status panels, or dialogue systems.