WoWInterface - View Single Post - Snapping Frames vertically horizontally
View Single Post
05-19-21, 12:53 AM   #7
nUI Maintainer
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,641
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.
  Reply With Quote