GuiGetAttribute
Jump to navigation
Jump to search
guiGetAttribute
Reads a safe attribute from an element in a loaded RML document.
Syntax
string guiGetAttribute(DocumentHandle document, string elementId, string name)
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
document |
DocumentHandle |
yes | The owning RML document handle. |
elementId |
string |
yes | The target element's id attribute. |
name |
string |
yes | The safe attribute name to read. |
Returns
Returns the attribute value, or an empty string when the document, element, attribute, or name is unavailable.
Examples
Read a custom data attribute:
local role = guiGetAttribute(window, "character-panel", "data-role")
outputDebugString("Selected role: " .. role)
Notes
- Available only in client-side resource scripts.
- The same safe-name policy as
guiSetAttributeis applied.