View Single Post
05-19-21, 12:53 AM   #7
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,927
I use minimal libraries myself but I do have multiple files in my addons.

If you put this line ( or similar ) at the top of each file they will have access to your addon wide table or namespace.

local addonName, addonTable = ...
This fills the variable addonName with the name of the addon in question and fills the variable addonTable with the data currently available to the addon.

For example: If I were to have an addon called Portals I could use the following:
local Portals, PortalsNS = ...

And then use local for variables and functions only used in that file, public for variables and functions you want other addons to access and PortalsNS[key] = function(...) end and PortalsNS[key] = value and PortalsNS[key] = { .. } and PortalsNS.variableName = value etc for data you want the rest of your addon to have access to.

Just make sure that the files are processed in the right order so that the relevant data is available when needed.
__________________


Characters:
Gwynedda - 70 - Demon Warlock
Galaviel - 65 - Resto Druid
Gamaliel - 61 - Disc Priest
Gwynytha - 60 - Survival Hunter
Lienae - 60 - Resto Shaman
Plus several others below level 60

Info Panel IDs : http://www.wowinterface.com/forums/s...818#post136818
  Reply With Quote