Using ACE Libs In My Addon Directory?

I have an addon that uses ACE to display a minimap icon. Currently, the required ACE libs reside in my addon’s directory tree which raises the question: do all addons that use ACE libs have their own private copy as part of their addon distribution?

Thanks,

Ace, and many other libs, use LibStub as their base which is used for version handling but that doesn’t mean you shouldn’t keep the libraries in your addon up-to-date because there is no guarantee a user has another addon with the latest.

I like to install Ace3 (alpha) by itself, just because then you get most of the libs and they load early alphabetically. So you need to worry less about an older addon loading an old lib.

But definitely keep your libraries updated if you’re managing an addon.

1 Like

I think the only time I used Ace3 was for my Arnold Sounds Event Add-on. On my Lua file I was able to add in the sounds I wanted and I guess Ace3 displays it in game on the sounds list in DBM.

WeakAuras gave me permission to use some codes mainly the spinners for some Unit Frames I made for Player / Target but I have no idea how I would add that into my add-on itself. Plus Buds said As long as your addon use licence compatible with GPL2 you can use code from weakauras otherwise you can’t. Basically it’s just some licence stuff I would have to add in I guess.

I wouldn’t mind giving it a try I just don’t know how to do that all on my own yet.

Related to my original post, suppose I have two addons: SomeAddon and MyAddonLIB. The latter provides services for SomeAddon as a dependency declared in the SomeAddon’s .TOC file. Further, suppose I want to call one of the library’s services named hello(), a function that prints “Hello world!” to the chat frame.

Here’s the application’s .TOC file with MyAddonLIB declared as a dependency.

## Interface: 30400 
##----------------------------------------------
## Title: SomeAddon
## Version: 1.0.0
## Dependencies: MyAddonLIB
## OptionalDeps:
## etc.,

Here is how the hello() function is defined in one of the library’s .lua files.

-- Filename Greetings.lua in MyAddonLib
local _, MyAddonLIB = ...
MyAddonLIB.Greetings = {}
greet = MyAddonLIB.Greetings

function greet:hello()
     DEFAULT_CHAT_FRAME:AddMessage( "Hello world!")
end

How do I call the greet:hello() function from within the SomeAddon? Calling the function directly, greet:hello() from within MyAddon doesn’t seem to work.

The ... arguments are specific and scoped to just the lua files under that addon folder so you would have to “export” the function(s) via a global in one way or another.

Is there a reason for not putting MyAddonLIB inside the addon folder? The “MyAddon” part of seems to indicate it only contains things specific to that addon and that way the addon and code in MyAddonLIB could all use the same ... information

I actually have a version of the library inside the addon folder. And it works very well. However, the reason for that is that debugging is easier. As it happens, MyAddonLIB is an asynchronous multithread library and when a failure occurs, the stack trace prints all the stack frames up to and through the offending application code. So, yeah, there is much to be said for that configuration and were this a standard addon I would absotively, posolutely put the library within the addon’s directory.

However, I’m experimenting with writing a monitor addon that could serve as an intermediate between separate addons, hence a standalone library. In any case, I want to find out if, whether, and how a postmaster-style monitor might be useful.

my addon 1 <------->monitor (lib) <------->my addon 2

Writing this is purely for my own interests.

Cheers,

You could just add a global function the Lib addon for testing purposes that returns it’s internal (…) table to the requester

Local Lib = MyAddonLIB_GetLib()
Lib:Hello()

Could always follow the LibStub instructions.
https://www.curseforge.com/wow/addons/libstub