Quantcast WoWInterface - View Single Post - Recursing Addons
View Single Post
08-02-18, 10:29 AM   #6
nUI Maintainer
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,448
This is how my mage portals addon handles its files. Hopefully it will help you see how it could be done.

## Interface: 80100
## Title: XMage : [ |cffeda55fPortals and Teleports|r ]
## Author: Tina Kirby AKA Xrystal (c) 2014-2020  All Rights Reserved
## Version:
## Notes: Mage Portals and Teleports Window 
## RequiredDeps: 
## OptionalDeps: 
## DefaultState: Enabled
## LoadOnDemand: 0
## SavedVariables: XMage_Portals_Settings

The main XML file - the Frames are configurable and are based on the templates. They share common code and all the files may need access to the data.
    <Script file = "XMage_Portals_Data.lua" />
    <Script file = "XMage_Portals_Code.lua" />
    <Include file = "XMage_Portals_Templates.xml" />
    <Include file = "XMage_Portals_Config.xml" />
    <Include file = "XMage_Portals_Frames.xml" />
The config.xml file
    <Script file = "XMage_Portals_Config.lua" />
    ... One or more frame definitions

The frames.xml file - This file is saying that the frames have customization functions ( they are called from other addons and used by the frame as and when it needs to ).
    <Script file = "XMage_Portals_Customization.lua" />
    <Script file = "XMage_Portals_Frames.lua" />
    ... One or more frame definitions
As long as the file that requires functionality of another file is loaded after it will work. If you find that there are sections you are using several times... put it in a file of its own near the beginning so that the rest of the files have access. And if you aren't using it already, don't forget the local addonName, addonData = ... line to allow the files to share the data.
  Reply With Quote