GuiSetAttribute: Difference between revisions
Jump to navigation
Jump to search
Automatyczna aktualizacja dokumentacji funkcji |
Complete Lua function catalog |
||
| Line 34: | Line 34: | ||
* Attribute names may contain letters, digits, underscores, hyphens, and colons. Names beginning with <code>on</code> are rejected to prevent event-handler injection. | * Attribute names may contain letters, digits, underscores, hyphens, and colons. Names beginning with <code>on</code> are rejected to prevent event-handler injection. | ||
[[Category:Lua Functions]] | |||
[[Category:Client Functions]] | [[Category:Client Functions]] | ||
[[Category:GUI Functions]] | [[Category:GUI Functions]] | ||
Latest revision as of 09:54, 15 August 2026
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.