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

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

XMage_Portals.xml
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.
Code:
<UI>
    <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" />
</UI>
The config.xml file
Code:
<UI>
    <Script file = "XMage_Portals_Config.lua" />
   
    ... One or more frame definitions

</UI>
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 ).
Code:
<UI>
    
    <Script file = "XMage_Portals_Customization.lua" />
    <Script file = "XMage_Portals_Frames.lua" />
    
    ... One or more frame definitions
</UI>
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