TOC format
.toc (Table of Contents) files contain information about a particular addon (such as its name, description, saved variables, etc), as well as instructions on how the addon should be loaded by the client (for example, the order in which lua and xml files should be loaded). The file must be present, and have the same name (plus extension) as its parent folder for the addon to be recognized by the client.
Basic rules
The .toc file and addon folder name need to match, e.g. ..\Interface\AddOns\MyAddon\
and MyAddon.toc
The file may contain the following elements:
- Metadata as
## Directive: Value
- Comments as
# this is a comment
- A list of files as
myFile.xml
orsubfolder\anotherFile.lua
Whitespace before #
will be interpreted as the start of a filename. However, the client trims whitespace around metadata values (after the colon).
Backslashes (\
) are recommended for subdirectories to prevent issues with <Include>
tags.
## Interface: 110002
## Title: Waiting for Godot
## Notes: Nothing to be done.
## Version: 1.0.0
# This line is a comment
Vladimir.xml
Estragon.lua
libs\SomeLibrary.lua
Multiple client flavors
Classic and retail versions of the game can be properly supported by including multiple TOC files in the same addon.[1] The client first searches for the respective suffix and otherwise falls back to AddonName.toc
- Clients also recognize legacy suffixes
-WOTLKC
and-BCC
. - The
_Classic
suffix has changed and is now used for addons that can be loaded on all Classic client flavors.- Files with this TOC suffix have a lower priority than other suffixes that target specific clients. For example, having both a
_Cata.toc
and_Classic.toc
file will result in the former being used on Cataclysm Classic clients, and the latter in all other Classic client flavors.
- Files with this TOC suffix have a lower priority than other suffixes that target specific clients. For example, having both a
File load order
The .toc file provides an ordered list of files to be loaded by the client. In the earlier example:
- Vladimir.xml loads first, and is in the same folder as the .toc file
- Estragon.lua loads second, and is in the same folder as the .toc file
- SomeLibrary.lua loads third, and is in a subfolder called libs
Not every file must appear in a .toc list:
- XML files may contain
<Script file="nameOfAnotherFile.lua" />
or<Include file="alsoLoadThis.xml" />
Texture:SetTexture()
andPlaySoundFile()
can use images and sounds contained within the addon folder and its subfolders
Interface version
"Interface" is the WoW version the addon was made for. WoW uses this number to tell if an addon is out of date.
If an addon has an older interface version than the user's current WoW client version, the addon is classified as out of date. If you don't specify an Interface version, WoW will always treat the addon as out of date.
If the game version is 10.2.7, then the interface version is 100207:
## Interface: 100207
You can also specify multiple versions with commas (this example targets 11.0.2, 4.4.0 and 1.15.3):
## Interface: 110002, 40400, 11503
Determining the interface version
GetBuildInfo
Type /dump (select(4, GetBuildInfo()))
in the chat box.
Warcraft Wiki
This wiki maintains a list template of the latest interfaces for each flavor of the game. The template is also shown below (these values are updated by contributors, so they may be out of date).
Expansion | Patch | TOC version | |
---|---|---|---|
Mainline PTR | 11.0.5 | 110005
| |
Mainline | 11.0.2 | 110002
| |
Cataclysm Classic | 4.4.0 | 40400
| |
Classic Era | 1.15.4 | 11504
|
AddOns list formatting
The following directives change how an AddOn appears in the AddOns list. Both may be coloured using UI escape sequences (e.g. |c########|r
), or localized by appending a hyphen and the locale code (e.g.Title-enGB
). Later entries overwrite earlier ones, so the non-localized fallback should go first.
Title
## Title: Waiting for Godot
## Title-frFR: En attendant Godot
Notes
## Notes: This word is |cFFFF0000red|r
IconTexture
## IconTexture: Interface\Icons\TEMP
IconAtlas
## IconAtlas: TaskPOI-Icon
Addon compartment integration
The following directives will control the registration of the addon into the Addon compartment dropdown accessible from the minimap.
AddonCompartmentFunc
## AddonCompartmentFunc: MyAddon_OnAddonCompartmentClick
AddonCompartmentFuncOnEnter
## AddonCompartmentFuncOnEnter: MyAddon_OnAddonCompartmentEnter
AddonCompartmentFuncOnLeave
## AddonCompartmentFuncOnLeave: MyAddon_OnAddonCompartmentLeave
Loading conditions
The following directives control when an AddOn loads, and any dependencies that must or may load first.
LoadOnDemand
Dependencies
RequiredDeps
and any word beginning with Dep
.
## Dependencies: someAddOn, someOtherAddOn
OptionalDeps
## OptionalDeps: someAddOn, someOtherAddOn
LoadWith
## LoadWith: someAddOn, someOtherAddOn
LoadManagers
## LoadManagers: someAddOn, someOtherAddOn
DefaultState
disabled
to require the user to explicitly enable the AddOn in the AddOns list.
## DefaultState: disabled
Saved variables
- Main article: Saving variables between game sessions
SavedVariables
WTF/[account]/SavedVariables
.
## SavedVariables: MyAddOnNameFoo, MyAddOnNameBar
SavedVariablesPerCharacter
WTF/[account]/[server]/[character]/SavedVariables
.
## SavedVariablesPerCharacter: MyAddOnNameAnotherVariable
Informational
The following metadata may be accessed using GetAddOnMetadata().
- Author
- The AddOn author's name, displayed
- Version
- The AddOn version. Some automatic updating tools may prefer that this string begins with a numeric version number.
- X-_____
- Any custom metadata prefixed by "X-", such as "X-Date", "X-Website" or "X-Feedback"
Restricted
The following tags are inaccessible to third-party AddOns.
AllowLoad
Restricts loading this addon to either the GlueXML or FrameXML environments.
Value | Environment |
---|---|
Both |
Allow this addon to load without restriction in all environments. |
Game |
Only load this addon in the FrameXML environment. |
Glue |
Only load this addon in the GlueXML environment. |
AllowLoadGameType
Restricts loading this addon to specific client flavors. Multiple values may be supplied, delimited by commas.
Game Type | Flavors | |
---|---|---|
mainline |
Mainline | |
classic |
All Classic flavors | |
cata |
Cataclysm Classic | |
wrath |
Wrath of the Lich King Classic | |
tbc |
Burning Crusade Classic | |
vanilla |
Classic Era | |
standard |
Normal game mode in all client flavors | |
wowlabs |
Special game modes, such as Plunderstorm |
LoadFirst
1
if a secure addon is not permitted to be disabled and should be loaded before any other addons without this flag.
OnlyBetaAndPTR
1
if an addon should only be loadable on test realms.
SavedVariablesMachine
List of global variable names to be persisted across all accounts on the same machine.
Secure
1
with Blizzard's digital signature to indicate a secure AddOn.
UseSecureEnvironment
1
if all files present in an addon should be loaded into a private function environment.
Details
- WoW reads up to the first 1024 characters of each line only. Additional characters are ignored and do not cause an error.
- Starting from Patch 9.0, 1.14.0 and 2.5.3, newly created/added files and even complete addons, are also detected when doing a
/reload
after the game started.
Patch changes
Retail
- Patch 11.0.0 (2024-07-23): Added the restricted UseSecureEnvironment metadata field. Removed the SuppressLocalTableRef metadata field.
- Patch 10.2.7 (2024-05-07): Added support for comma-delimited Interface versions, and the restricted AllowLoadGameType and SuppressLocalTableRef metadata fields. Renamed AllowLoadByGameMode to AllowLoadGameType, and GuardedAddOn to LoadFirst.
- Patch 10.2.6 (2024-03-19): Added the restricted AllowLoadByGameMode metadata field.
- Patch 10.1.0 (2023-05-02): Added IconAtlas, IconTexture, and Addon compartment related metadata fields. Added the restricted GuardedAddOn metadata field.
- Patch 9.1.0 (2021-06-29): Multiple TOC files are now supported using a suffix to disambiguate Classic, BCC and Retail.[1]
- Patch 9.0.1 (2020-10-13): /reload recognizes changes to TOC metadata and entirely new files in the Interface/AddOns/ directory tree.
- Patch 4.0.1 (2010-10-12): /reload recognizes changes to the file order.
- Patch 2.1.0 (2007-05-22): Added LoadManagers metadata
- Patch 1.11.0 (2006-06-19): Added Secure metadata
- Patch 1.9.0 (2006-01-03): Added LoadWith metadata
Classic
- Patch 4.4.1 (PTR): Includes all changes present in patch 11.0.0.
- Patch 4.4.0 (2024-04-30): Includes all changes present in patch 10.2.7. Additionally, the behavior of the _Classic TOC suffix has changed such that it now loads on all Classic clients, and not just Classic Era.
Classic Era
- Patch 1.15.4 (2024-09-24): Includes all changes present in patch 11.0.0.
See also
- GetAddOnInfo returns basic information about an addon.
- Using the AddOn namespace describes the parameters passed to each file.
References
- ^ a b Meorawr. Multiple Interface Version Support. WoWUIBugs.
|