Documentation / XML guide
Values and text
KeyValues, Attributes and text taken from the game's strings.
KeyValues: values for your Lua
<KeyValue> puts a value into the region's own table, so the region's Lua can read it as
self.title. A template's KeyValues let each frame made from it carry its own settings for shared code.
<Frame name="MyBarFrame" parent="UIParent" mixin="MyBarMixin">
<KeyValues>
<KeyValue key="title" value="My bar"/> <!-- a string -->
<KeyValue key="maxButtons" value="12" type="number"/>
<KeyValue key="showEmpty" value="true" type="boolean"/>
<KeyValue key="system" value="Enum.EditModeSystem.ActionBar" type="global"/>
<KeyValue key="1" keyType="number" value="first"/> <!-- self[1] -->
</KeyValues>
<Attributes>
<Attribute name="actionpage" type="number" value="6"/>
</Attributes>
</Frame>
type | The value becomes |
|---|---|
string (or none) | The text as written. |
number | A number; 0 if it isn't one. |
boolean | true for true or 1, otherwise false. |
global | The global it names, which may be a dotted path into tables, as Blizzard's
Edit Mode writes Enum.EditModeSystem.ActionBar. Blizzard's code |
nil | Nothing: the key is cleared. |
keyType="number" makes the key a number, for lists: self[1]. KeyValues are in place before
the frame's OnLoad runs, including those of templates applied after a child was made
(When OnLoad runs).
Attributes: values for secure code
<Attribute> sets what self:GetAttribute(name) reads, as SetAttribute
would. Blizzard's action bars give their page this way. The types are string (the default),
number, boolean and nil. They are set as the frame is built, before OnLoad.
Blizzard's code
Guessed that setting them doesn't run OnAttributeChanged.
text: the game's own strings
A text="" that names one of the game's global strings shows that string, so text="CANCEL"
shows the game's string CANCEL, in the client's own language. Anything else is shown as written.
1,364 font strings in Forever's own XML are written this way.
Blizzard's code
<Button name="MyCancel" inherits="UIPanelButtonTemplate" text="CANCEL"/>
<FontString inherits="GameFontNormal" text="Not a game string, shown as written"/>
text="", empty, leaves the region with no text at all: GetText() gives nil, not an empty
string. Measured (Retail)