ruk·si

🌙 WoW API
Structure

Updated at 2015-01-17 01:56

You'll have a folder in Interface\AddOns\<YourAddon> containing a TOC file, Lua files, and possibly XML and other assets.

Addons are initialized from the TOC file (Table of Contents). Put each Lua file in your .toc in the order they should be loaded

## Interface: 11200
## Title: MyApp
## Notes: A short description what this addon does.
## Version: 0.1.0
## Author: Ruksi
## X-Email: me@ruk.si
## SavedVariables: MyAddonData
## SavedVariablesPerCharacter: MyAddonData

# The files are loaded in the order they appear here:
core.lua
utils.lua
ui.lua

Addon API blocks normal code import functions like require, dofile, and loadfile so you must rely on the file load order in the TOC file.

The TOC file can specify saved variables to persist user settings across sessions as shown above.

Use a global table like MyAddon = MyAddon or {} to share definitions.

MyAddon = MyAddon or {}
MyAddonData = MyAddonData or {}
MyAddonHeroData = MyAddonHeroData or {}

Avoid polluting the global namespace and use local for other definitions.