GuiGetAttribute: Difference between revisions
Jump to navigation
Jump to search
Automatyczna aktualizacja dokumentacji funkcji |
Complete Lua function catalog |
||
| Line 33: | Line 33: | ||
* The same safe-name policy as <code>guiSetAttribute</code> is applied. | * The same safe-name policy as <code>guiSetAttribute</code> is applied. | ||
[[Category:Lua Functions]] | |||
[[Category:Client Functions]] | [[Category:Client Functions]] | ||
[[Category:GUI Functions]] | [[Category:GUI Functions]] | ||
Latest revision as of 09:54, 15 August 2026
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.