Documentation / XML guide
Files and loading
The .toc, the elements a file may hold at the top, and how other files are found.
An addon's .toc file lists its Lua and XML files. They load in that order, each one finished
before the next starts. Inside an XML file, Lizzard takes the top-level elements in the order they are
written, and an <Include> or <Script> loads its file there and then.
MyAddon.toc
## Interface: 16001
## Title: My Addon
Core.lua
Frames.xml
Main.lua
Frames.xml
<Ui xmlns="http://www.blizzard.com/wow/ui/">
<Include file="Templates.xml"/>
<Script file="Frames.lua"/>
<Frame name="MyWindow" parent="UIParent" inherits="MyWindowTemplate"/>
</Ui>
What a file may hold at the top
| Element | What Lizzard does |
|---|---|
<Script file="x.lua"/>, or a <Script> with Lua inside |
Runs the file, or the Lua written inside. |
<Include file="x.xml"/> | Loads that XML file, there and then. |
<Font>, <FontFamily> |
Makes a font object, a global by its name, even when it says virtual="true". A font
family uses the member for the client's alphabet: roman on an English client. |
Anything with virtual="true" | Keeps it as a template, to be used by inherits
(Templates). |
Anything with intrinsic="true" | Makes a new element name that works like a frame type (intrinsic types). |
A frame: <Frame>, <Button>, <EditBox> and the rest |
Builds it now. |
<ScopedModifier> | Loads what is inside it as if it were at the top. Its own attributes concern Blizzard's protected code and are not read. |
| Anything else | Leaves it out and says so once: "top-level <X> is not loaded yet". |
Finding the files
Paths in file="" use backslashes, as Blizzard's files do: file="Widgets\Button.xml".
Lizzard looks beside the XML file first, then from the addon's own folder. Blizzard's code needs the second:
one of Retail's item button files names its Lua from the addon's folder.
Guessed which one the game tries first.
A Lua file run by <Script file> gets the addon's name and its shared table as
..., as a Lua file listed in the .toc does.
Guessed
Spelling counts
- Element and attribute names are matched exactly, in the case
UI.xsdgives. A<script>in lower case is not a<Script>: Lizzard turns it away. - The namespace on
<Ui>doesn't change anything; only the element names count. - Yes or no attributes take
trueorfalse;1and0work too, asUI.xsdallows.