GuiGetAttribute

From Wiki G1R-MP G1 Remake Multiplayer
Revision as of 09:54, 15 August 2026 by QCherry (talk | contribs) (Complete Lua function catalog)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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 guiSetAttribute is applied.