GuiSetAttribute

From Wiki G1R-MP G1 Remake Multiplayer
Revision as of 20:13, 5 August 2026 by QCherry (talk | contribs) (Automatyczna aktualizacja dokumentacji funkcji)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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 on are rejected to prevent event-handler injection.