Quantcast
Download
(2 Kb)
Download
Updated: 05/26/19 12:25 PM
Compatibility:
Elsweyr (5.0.5)
Wrathstone (4.3)
Murkmire (4.2)
Wolfhunter (4.1)
Summerset (4.0)
Dragon Bones (3.3)
Clockwork City (3.2)
Horns of the Reach (3.1)
Morrowind (3.0)
Homestead (2.7)
One Tamriel (2.6)
Shadows of the Hist (2.5)
Dark Brotherhood (2.4)
Thieves Guild (2.3)
Orsinium (2.2.4)
Updated:05/26/19 12:25 PM
Created:01/02/16 10:19 PM
Monthly downloads:25,251
Total downloads:51,457
Favorites:84
MD5:
5.0.5
LibLoadedAddons  Popular! (More than 5000 hits)
Version: 1.4
by: uladz, Baertram
This is for Addon Developers Only

What does it do?
It tracks what addons are loaded so you don't have to. It allows you to easily check and see if any addon is running. It also allows you to register your addon version number so that other addons can also see which version of your addon is running.

This library does NOT use the library LibStub anymore. Please use the global variable LibLoadedAddons to refernce this library

Benefits to registering your addons version number:
  • Allows other addons to know which version of your addon is running.
  • This can serve as a signal to let other addons know when your addon is done initializing and everything is ready & accessible to them.
How do I use it?
Load the library in every lua file you wish to use it in:
Lua Code:
  1. local LIBLA = LibLoadedAddons

To register your addons version number:
* It is highly recommended that you wait until your addon is fully initialized before registering your addons version number. This way when other addons check to see if your addon is loaded they can check the version number to see if you are done initializing and know that everything is ready and accessible.
Lua Code:
  1. LIBLA:RegisterAddon(string ADDON_NAME, number ADDON_VERSION)
  • ADDON_VERSION must be of type(ADDON_VERSION) == number
  • ADDON_NAME must match the name of your addon used for your addon folder & manifest. The same string you use in your OnAddonLoaded function.

To check if an addon is loaded:
Lua Code:
  1. local isLoaded, versionNum = LIBLA:IsAddonLoaded("QuestTracker", true)
  • Whether addons register their version number or not you can still see if they are loaded.
  • The returned versionNum will be 0 if the addon has not registered their version number.
  • The 2nd parameter of the function LIBLA:IsAddonLoaded is optional. If you leave it empty it will be the same as true and only return the version of the addon as 2nd return parameter
  • If you change the 2nd parameter of the function LIBLA:IsAddonLoaded to false the functio will not only return the version as 2nd return parameter, but a tablew containing all addonInformation read from the ingame addon manager:
Lua Code:
  1. local isLoaded, addonInfoTable= LIBLA:IsAddonLoaded("QuestTracker", false)
[Version 1.4]
Fixed: Function to register a version was not writing the version properly in some cases.

[Version 1.3]
-Updated API fopr Elsweyr
-Added ##IsLibrary: true tag to manifest txt
-Added ##AddOnVersion tag to manifest txt
-Removed usage and dependency to LibStub

[Version 1.2]
Changed loading of the library: Older verisons of this library will register addons loaded already before LibStub "overwrites" the older version of this library with the more up2date one.
Already loaded addons will be kept in the variable "loadedAddons" now, and will not be cleared again.

[Version 1.1]
Updated: API
Added: Manifest TXT file, dependency to LibStub, included obligatory library LibStub
You might remove the library LibStub from this library and just install LibStub as standalone version (like a normal addon via the Minion addon manager e.g.) too!
Archived Files (4)
File Name
Version
Size
Uploader
Date
1.3
2kB
Baertram
05/19/19 04:44 PM
1.2
2kB
Baertram
09/17/18 04:34 AM
1.1
2kB
Baertram
08/30/18 12:10 PM
1.0
1kB
circonian
01/02/16 10:19 PM


Post A Reply Comment Options
Unread 04/30/19, 10:38 AM  
Baertram
 
Baertram's Avatar
AddOn Author - Click to view AddOns

Forum posts: 2166
File comments: 2354
Uploads: 56
PTS version 1.3 WITHOUT LibStub -> You need to adopt your addons to use the global variable
Code:
LibLoadedAddons
now and strip the call to LibStub in your addons!

Lua Code:
  1. --- The library will automatically add all enabled AddOns to it's internal table
  2. --- LibLoadedAddons.loadedAddons with the addonName as the index and a table containing
  3. --- this data as value:
  4. --LibLoadedAddons.loadedAddons[name]["name"]            = name                  --String, from the folder/manifest TXT file name of the AddOn
  5. --LibLoadedAddons.loadedAddons[name]["title"]           = title                 --String, from ##Title TXT manifest file's tag
  6. --LibLoadedAddons.loadedAddons[name]["author"]          = author                --String, from ##Author TXT manifest file's tag
  7. --LibLoadedAddons.loadedAddons[name]["description"]     = description           --String, from ##Description TXT manifest file's tag
  8. --LibLoadedAddons.loadedAddons[name]["enabled"]         = tostring(enabled)     --Boolean, from AddOnManager
  9. --LibLoadedAddons.loadedAddons[name]["loadState"]       = tostring(loadState)   --AddOnLoadState, from AddOnManager
  10. --LibLoadedAddons.loadedAddons[name]["isOutOfDate"]     = tostring(isOutOfDate) --Boolean, from AddOn manager
  11. --LibLoadedAddons.loadedAddons[name]["isLibrary"]       = tostring(isLibrary)   --Boolean, Integer from ##IsLibrary: TXT manifest file's tag
  12. --LibLoadedAddons.loadedAddons[name]["version"]         = addOnVersion          --Integer from ##AddOnVersion: TXT manifest file's tag

Attention:
As the addon's version from ##AddOnVersion: can only be a signed integer value you need to either use LibLoadedAddons:LibLoadedAddons:RegisterAddon to overwrite teh value with something you want it to be used and compared against, or you need to change depending addons so they will check for the integer signed value of the addon in the future.

So just keep on using
LibLoadedAddons:RegisterAddon(uniqueAddOnName, versionNumber) and the table entry will be updated.

And LibLoadedAddons:RegisterAddon:IsAddonLoaded(uniqueAddonName, onlyVersionNr) to get the version number again.
OnlyVersionNr is a new boolean and preset with true. If you set it to false you'll get the total addonInfo table for the uniqueAddonName!
Last edited by Baertram : 04/30/19 at 10:43 AM.
Report comment to moderator  
Reply With Quote
Unread 02/07/18, 08:55 PM  
Dolgubon
 
Dolgubon's Avatar
AddOn Author - Click to view AddOns

Forum posts: 337
File comments: 596
Uploads: 15
Originally Posted by SteveCampsOut
The problem I have with authors using other people's libraries is this. When the library goes out of date they have to rely on the original author to update them. I have 4 lib addons that are in my addons menu that are currently out of date but as they don't appear in my addons folder by themselves I must assume they're loaded under one of my addons and have to hunt them down and manually update them myself. End users should not have to do this to keep their addons up to date.

LibAsync
LibLoadedAddons are two of them.
First of all, this is not due to the addon or library authors. Libraries previously did not, and generally will not show up on the addons list, outside of a few libraries which have settings or are commonly installed as stand alone addons. (e.g. LAM or LibGroupSocket) The only reason those libraries are now showing up is because of a change in how add-ons are detected.

Second, regardless of if a library is kept updated or not, there's many addons which would not exist because of one library or another.
Last edited by Dolgubon : 02/07/18 at 11:14 PM.
Report comment to moderator  
Reply With Quote
Unread 02/07/18, 03:38 PM  
SteveCampsOut
 
SteveCampsOut's Avatar

Forum posts: 23
File comments: 303
Uploads: 0
The problem I have with authors using other people's libraries is this. When the library goes out of date they have to rely on the original author to update them. I have 4 lib addons that are in my addons menu that are currently out of date but as they don't appear in my addons folder by themselves I must assume they're loaded under one of my addons and have to hunt them down and manually update them myself. End users should not have to do this to keep their addons up to date.

LibAsync
LibLoadedAddons are two of them.
Last edited by SteveCampsOut : 02/07/18 at 03:39 PM.
Report comment to moderator  
Reply With Quote
Unread 04/09/16, 08:23 PM  
merlight
AddOn Author - Click to view AddOns

Forum posts: 665
File comments: 212
Uploads: 12
Originally Posted by uladz
Technically correct, logically not correct. Libraries do not have any use on their own, only when another code uses to perform some actions via their APIs. Libraries are a sort of factories, or frameworks, or whatever you call it. For example LibAddonMenu has not use if I just drop it into my Addons directory, it's a facility that another addon can re-use to standardize how setting are published and managed. Libraries give up purely APIs but not a complete user facing product, which is in this case would happen to be an addon. So there is a huge different in design between libraries and addons. And of cause libraries are shared between addons, addons can interact with each other on contrary.
If you really want to make that distinction, you're making it on the wrong level. LibAddonMenu, the thing you download here, is an add-on. When the add-on is loaded, it publishes an API via LibStub, the registry of libraries. That's only to not pollute the global namespace, some libraries publish global functions. Library=API. I could create an add-on that provides LibFoo, LibBar and LibPuzzles. Of course that would be silly and confusing. The convention is to package those separately.

When another add-on wants to use LibAddonMenu, it asks LibStub to give it the API table. It doesn't care whether the API was registered by ThisAddon/Libs/LibAddonMenu.lua, UnrelatedAddon/Libs/LibAddonMenu.lua, stand-alone LibAddonMenu/LibAddonMenu.lua, or FakeLAM/LibAddonMenu.lua. The only reason we embed Libs/* we use inside add-on zip is convenience, so that users don't have to install and update all dependencies separately.


Let me put it this way. You want your add-ons Joe and Bob to know each other's version, and publish some functions so they can communicate. Why not use LibStub, which is already there, used by many?
Lua Code:
  1. -- bob.lua
  2. local bob = LibStub:NewLibrary("Bob", 3.2)
  3.  
  4. function bob.pingJoe()
  5.     local joe, joeVer = LibStub:GetLibrary("Joe", LibStub.SILENT)
  6.     if joeVer and joeVer >= 3.0 and joeVer < 4.0 then
  7.         pcall(joe.ping, "hey, Bob's here")
  8.     end
  9. end
  10.  
  11. -- joe.lua
  12. local joe = LibStub:NewLibrary("Joe", 3.3)
  13.  
  14. function joe.ping(msg)
  15.     df("ping: %s", tostring(msg))
  16. end

That's it. There's no reason to have another namespace for APIs whose only difference is that they don't have "Lib" in their name; and another library duplicating LibStub.
Report comment to moderator  
Reply With Quote
Unread 04/06/16, 08:01 PM  
uladz
AddOn Author - Click to view AddOns

Forum posts: 11
File comments: 224
Uploads: 2
Originally Posted by Ayantir
And beside this brain****.. Which addons should communicate together ?.. Which authors are ready to do this ?.. And what is the purpose ?.. Are we even capable (addon community) to build new things, we are losing more and more authors, projects are becoming very hard to update due to lack of time, skill, motivation ..
Well, for what it worth I'm trying to get ahold of ESO API and pick up development of some of the addons that were left behind now. Yes lack of time and something that puts many things on hold. Another problem is that there is no documentation or any reference so I have to dig it piece by piece from source code of other addons. The questions I ask are not from thin air, this is something that I come across and find it missing from current implementations. I might tend to over-engineer some things that may be done over simpler but less systematic way, but that's more of my professional nature takes its toll here .
Report comment to moderator  
Reply With Quote
Unread 04/06/16, 07:22 PM  
Ayantir
 
Ayantir's Avatar
AddOn Author - Click to view AddOns

Forum posts: 1022
File comments: 1561
Uploads: 31
Originally Posted by uladz
Technically correct, logically not correct. Libraries do not have any use on their own, only when another code uses to perform some actions via their APIs. Libraries are a sort of factories, or frameworks, or whatever you call it. For example LibAddonMenu has not use if I just drop it into my Addons directory, it's a facility that another addon can re-use to standardize how setting are published and managed. Libraries give up purely APIs but not a complete user facing product, which is in this case would happen to be an addon. So there is a huge different in design between libraries and addons. And of cause libraries are shared between addons, addons can interact with each other on contrary.

Originally Posted by merlight
Originally Posted by uladz
Addons and libraries should not be mixed together.
Except that libraries are add-ons, which only happen to be embeddable without conflicts thanks to LibStub. And if your add-on has public API, it is a library.

And beside this brain****.. Which addons should communicate together ?.. Which authors are ready to do this ?.. And what is the purpose ?.. Are we even capable (addon community) to build new things, we are losing more and more authors, projects are becoming very hard to update due to lack of time, skill, motivation ..


In 2 months, VR will be removed, ALL addons with a single call to GetVeteranThing() will be to rewrite, we will have lot of addons to rewrite, that's a huge amount of thing to do.. ESO has its base of addons, if you want to improve them.. there is a ton of addons to rewrite with a poor level of coding which could be optimized, there is less than 10 addons with a GUI which are Gamepad ready.. less than 10.. I do think improving those points are more important than to bring addon communication, especially when you can write a public func in 30sec.
__________________
Obsessive Compulsive Coder

My little french Guild: Cercle de l'Eveil
Last edited by Ayantir : 04/06/16 at 07:29 PM.
Report comment to moderator  
Reply With Quote
Unread 04/06/16, 06:14 PM  
uladz
AddOn Author - Click to view AddOns

Forum posts: 11
File comments: 224
Uploads: 2
Technically correct, logically not correct. Libraries do not have any use on their own, only when another code uses to perform some actions via their APIs. Libraries are a sort of factories, or frameworks, or whatever you call it. For example LibAddonMenu has not use if I just drop it into my Addons directory, it's a facility that another addon can re-use to standardize how setting are published and managed. Libraries give up purely APIs but not a complete user facing product, which is in this case would happen to be an addon. So there is a huge different in design between libraries and addons. And of cause libraries are shared between addons, addons can interact with each other on contrary.

Originally Posted by merlight
Originally Posted by uladz
Addons and libraries should not be mixed together.
Except that libraries are add-ons, which only happen to be embeddable without conflicts thanks to LibStub. And if your add-on has public API, it is a library.
Report comment to moderator  
Reply With Quote
Unread 04/06/16, 06:08 PM  
merlight
AddOn Author - Click to view AddOns

Forum posts: 665
File comments: 212
Uploads: 12
Originally Posted by uladz
Addons and libraries should not be mixed together.
Except that libraries are add-ons, which only happen to be embeddable without conflicts thanks to LibStub. And if your add-on has public API, it is a library.
Report comment to moderator  
Reply With Quote
Unread 04/06/16, 06:06 PM  
uladz
AddOn Author - Click to view AddOns

Forum posts: 11
File comments: 224
Uploads: 2
I understand, that is why I proposing to extend it.

What the reason to do not have API publishing alongside with announcing loaded addons? Spawning single-use libraries just to facilitate interaction between two addons is absolut nonsense as it defeats the meaning of a library. Having a global (public) function in addons is something I want to prevent to minimize global namespace pollution and collisions.

As it is right now the LibLoadedAddons has very little to none of use. With addon API publishing is gets on an importance piece of functionality that actually make the addon usable as a inter-addong glue layer.

[quote=Ayantir][quote=uladz]
Originally Posted by merlight
Originally Posted by uladz
Versus this LibLoadedAddons library, which suppose to provide singleton type inter-addon communication facility. Addons and libraries should not be mixed together.
LibLoadedAddons don't do that. To make 2 addons discuss together, use a shared lib between addons or add public functions in both addons.

LibLoadedAddons is just telling you if an addon is loaded by looking to AddonManager.
Report comment to moderator  
Reply With Quote
Unread 04/06/16, 04:56 PM  
Ayantir
 
Ayantir's Avatar
AddOn Author - Click to view AddOns

Forum posts: 1022
File comments: 1561
Uploads: 31
[quote=uladz][quote=merlight]
Originally Posted by uladz
Versus this LibLoadedAddons library, which suppose to provide singleton type inter-addon communication facility. Addons and libraries should not be mixed together.
LibLoadedAddons don't do that. To make 2 addons discuss together, use a shared lib between addons or add public functions in both addons.

LibLoadedAddons is just telling you if an addon is loaded by looking to AddonManager.
__________________
Obsessive Compulsive Coder

My little french Guild: Cercle de l'Eveil
Report comment to moderator  
Reply With Quote
Unread 04/06/16, 12:35 PM  
uladz
AddOn Author - Click to view AddOns

Forum posts: 11
File comments: 224
Uploads: 2
Originally Posted by merlight
Originally Posted by uladz
sharing of APIs between addons without exposing global objects/functions.
There's LibStub for that.
Not exactly, the whole purpose of LibStub is completely different and should not be mixed with LibLoadedAddons. LibStub should be used for libraries to resolve multiple versions conflicts and provide only one the most recent library API to all addons loaded. it has own mechanism of "registering" libraries and selecting the most recent version. Versus this LibLoadedAddons library, which suppose to provide singleton type inter-addon communication facility. Addons and libraries should not be mixed together.
Report comment to moderator  
Reply With Quote
Unread 04/06/16, 05:35 AM  
merlight
AddOn Author - Click to view AddOns

Forum posts: 665
File comments: 212
Uploads: 12
Originally Posted by uladz
sharing of APIs between addons without exposing global objects/functions.
There's LibStub for that.
Report comment to moderator  
Reply With Quote
Unread 04/05/16, 09:29 PM  
uladz
AddOn Author - Click to view AddOns

Forum posts: 11
File comments: 224
Uploads: 2
Guys, how do you manage development of this library? I have some changes that I want to contribute back. I've tried to PM @circonian but did not get any reply yet. My address what I have proposed in my previous post - sharing of APIs between addons without exposing global objects/functions.
Report comment to moderator  
Reply With Quote
Unread 03/22/16, 10:55 PM  
uladz
AddOn Author - Click to view AddOns

Forum posts: 11
File comments: 224
Uploads: 2
suggestion

I would suggest to add an additional API method to get addon object in case if you want to access its API
Lua Code:
  1. LIBLA:RegisterAddon(string ADDON_NAME, number ADDON_VERSION, table ADDON_OBJECT)
  2. local addon = LIBLA:GetAddon("QuestTracker")
This would decouple internal addon main object defition from public. Now I see that people just declare it as global variable allowing every other addon to see it it case if then want to inter-connect. I need to do the same thing now to make to addons work together but I'm far from liking this solution. This library seems to be the right way to go but I'm missing GetAddon functionality.
Please consider extending this library API, this can be done 100% backward compatible. Thanks!
Last edited by uladz : 03/22/16 at 10:56 PM.
Report comment to moderator  
Reply With Quote
Unread 01/28/16, 10:15 PM  
circonian
AddOn Author - Click to view AddOns

Forum posts: 648
File comments: 804
Uploads: 27
Of course. But a library should at the very least reduce code duplication, or simplify working with awkward API, implementation details and such. Okay, so it reduces some bloat. If you need to check for many addons, that may pay off. With just one, not worth it.
I have one addon that watches for 6 other addons.

"A good library is easy to use, and hard to misuse." That's what I mean by "encourages bad practice". You provide the tool to check whether version >= 2.5. It's easy to misuse.
I would argue that even in that worst case scenario of someone using it poorly >= 2.5 that they are still better off than someone not checking a version number at all. It eliminates versions < 2.5, assuming those are known to be incompatible (otherwise there was no point in the check). It may be minor, but that's the worst case scenario and there is only benefit there & no loss.

If I wanted to call a function from another add-on, I'd first check that it exists, and then pcall(it). Who wants to test against each new version that comes out, and manually bump version numbers?
I would also recommend checking first...but if your doing that, then that nullifies the original comment. If that user checked the existence of the function first it really doesn't matter if he uses >= 2.5 and the other addon removes the function. However that wouldn't catch a problem if the users updates the addon & changes the function. I'm just saying, the existence of the function isn't always the problem. I agree that I wouldn't want to bump version numbers either & wouldn't use the check, but that doesn't mean its not beneficial if used. More work to keep it up to date, but it would prevent problems too.

As I said I never had any intention of posting it, because I agree it is a bit superfluous, but someone asked me for it and I still see no harm or downside, so I wasn't going to tell them no.
__________________
My Addons: JunkIt, FilterIt, WaypointIt, LootIt, TweakIt, ChatIt, SortIt
My Libs & Other Developer Stuff: Click4Info, LibNeed4Research, LibMsgWin, LibFilterIt, LibItemInfo
Other Files & Works In Progress can be found on my Dropbox: ESO Dropbox
Report comment to moderator  
Reply With Quote
Post A Reply



Category Jump: