GuiSetAttribute
guiSetAttribute
Sets a safe attribute on an element in a loaded RML document.
Syntax
bool guiSetAttribute(DocumentHandle document, string elementId, string name, string value)
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 | A safe attribute name up to 64 characters. |
value |
string |
yes | The attribute value, up to 4096 bytes. |
Returns
Returns true when the attribute is applied; otherwise returns false.
Examples
Store a role on a panel element:
guiSetAttribute(window, "character-panel", "data-role", "medic")
Notes
- Available only in client-side resource scripts.
- Attribute names may contain letters, digits, underscores, hyphens, and colons. Names beginning with
onare rejected to prevent event-handler injection.