Quantcast Ace3 Module with sub modules? - WoWInterface
Thread Tools Display Modes
07-24-19, 10:08 AM   #1
Lybrial
A Theradrim Guardian
AddOn Compiler - Click to view compilations
Join Date: Jan 2010
Posts: 66
Ace3 Module with sub modules?

Hi,

im using Ace3 since its making a lot of work much easier. Today I was wondering
if it is possible to create Ace3 modules with submodules.

Usually you create modules for addons like this:

Lua Code:
  1. AddOn = ACE3:NewAddon("AddOn");
  2. Module = AddOn:NewModule("Module");

What I would like to do is something like this:

Lua Code:
  1. AddOn = ACE3:NewAddon("AddOn");
  2. Module = AddOn:NewModule("Module");
  3. SubModule = Module:NewModule("SubModule");

I want to do that because sometimes things are getting too big. For example im working on data texts. So I have my main addon and a data texts module. keeping all data texts in that module is way too big so I would like to split them into sub modules.
  Reply With Quote
07-24-19, 01:23 PM   #2
myrroddin
A Pyroguard Emberseer
 
myrroddin's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 1,029
From line 221 of AceAddon-3.0:
Lua Code:
  1. -- A module has the same functionality as a real addon, it can have modules of its own, and has the same API as
  Reply With Quote
07-24-19, 03:09 PM   #3
Lybrial
A Theradrim Guardian
AddOn Compiler - Click to view compilations
Join Date: Jan 2010
Posts: 66
Thx. But im getting nil if I do it:

Main Addon:

Lua Code:
  1. LybrialUI = ACE3:NewAddon("Lybrial UI");

MiniMap AddOn:

Lua Code:
  1. LybrialMiniMap = LybrialUI:NewModule("Lybrial MiniMap");
  2. LybrialUI:RegisterModule("Lybrial MiniMap", LybrialMiniMap);

Module of MiniMap:

Lua Code:
  1. Texts = LybrialMiniMap:NewModule("Texts");

SubModule of MiniMap Module:

Lua Code:
  1. Zone = Texts:NewModule("Zone"); -- ERROR: Texts is nil

My import order:

Addon .toc:

Lua Code:
  1. ##################
  2. ## Init
  3. init.lua
  4. ##################
  5.  
  6. ## Modules:
  7. modules\modules.xml

MiniMap .toc:

Lua Code:
  1. ##################
  2. ## Init
  3. init.lua
  4. ##################
  5.  
  6. ## Modules:
  7. modules\modules.xml

MiniMap modules.xml:

xml Code:
  1. <Ui xmlns="http://www.blizzard.com/wow/ui/">
  2.     <Script file="general.lua"/>
  3.     <Script file="appearance.lua"/>
  4.     <Script file="position.lua"/>
  5.     <Script file="clicks.lua"/>
  6.     <Script file="buttons.lua"/>
  7.     <Script file="texts.lua"/>
  8.     <Script file="version.lua"/>
  9.  
  10.     <Script file="texts\init.lua"/>
  11.     <Include file="texts\modules\modules.xml"/>
  12. </Ui>
  Reply With Quote
07-24-19, 06:04 PM   #4
myrroddin
A Pyroguard Emberseer
 
myrroddin's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 1,029
  1. What is RegisterModule? NewModule already does that.
  2. In the .tocs of the modules, you are missing a field.
Code:
## RequiredDeps: NameOfCoreAddOn
And if the second module requires the first module, its .toc should read:
Code:
## RequiredDeps: NameOfCoreAddOn, NameOfFirstModule
Next, in your core and modules, if they are their own addons as such with their own .toc files, then don't try to load them via the core addon's .toc.
  Reply With Quote
07-24-19, 06:07 PM   #5
myrroddin
A Pyroguard Emberseer
 
myrroddin's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 1,029
SmartRes2 and its Chat Module don't work anymore, but the code examples will still be of help.
  Reply With Quote
07-25-19, 04:23 AM   #6
Lybrial
A Theradrim Guardian
AddOn Compiler - Click to view compilations
Join Date: Jan 2010
Posts: 66
Hi,

ignore RegisterModule. Its stuff that I implemented myself. Should not have posted it.

my core .toc file does not load the modules which are standalone addons.
Core is just the main addon containing core functionality and also general modules.

My other addons have their own .toc file and load their own modules individually.
But everyone of my addons depends on core:

Lua Code:
  1. ## Dependencies: Lybrial_Core

However. Turned out that the Error was missleading and the source of it was something different.
So the the stuff I posted works fine.

Thx
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Ace3 Module with sub modules?

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off