Lore archive · Warcraft Wiki, 2023 dump
Using the AddOn namespace
Last wiki revision 2022-09-24
The addon namespace is a private table shared between Lua files in the same addon. It allows for addons to access data between files without exposing or polluting variables to the global environment. addonName, addonTable = ...
- addonName : string - The name of your addon as in the TOC file and folder name.
- addonTable : table - The shared addon table between the Lua files of an addon.
This addon defines the "foo" key on the addon table in and accesses it in
MyAddon.toc FileA.lua FileB.lua
- 1) Interface:
- 2) Version: 1.0.0
- 3) Title: Test
FileA.lua
FileB.lua
You can also simply use a unique global variable.
FileA.lua FileB.lua
Source
https://warcraft.wiki.gg/wiki/Using_the_AddOn_namespace · retrieved 2023-11-13 · CC BY-SA 4.0
Converted from wikitext with templates, tables and images removed, so some sentences may be missing values.
This archive predates WoW: Forever. For collected gameplay facts see the Forever database. Search the archive.