Thread Tools Display Modes
05/19/20, 09:54 AM   #1
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,912
HowTo: AddOn dependencies/Libs in Subfolder/Removal of LibStub

Dependencies (e.g. libraries) of AddOns

Dependencies are other AddOns or libraries, which must be enabled in-game in order to let your addon in question work properly.

Libraries are a special kind of AddOn. They are re-usable code which can be installed e.g. once so that multiple AddOns are able to benefit from it (e.g. zone information, quest information, item sets, …).

The in-game AddOn manager is a tool provided by the game developers to let you enable/disable the AddOns of your choice.
It lists the addon in a scrollable list, sorted by their name alphabetically.
In the in-game AddOn manager you are able to see the AddOns and the libraries in 2 separated sections.
At the top there are the AddOns (1, see 1st screenshot below),
and at the bottom the libraries, below the headline “Libraries” (3, see 2nd screenshot below).

To use the in-game AddOn manager you got 2 possibilities, after starting and logging in to the game:
1st) At the character selection screen choose the entry Add-Ons at the left menu.
You are able to preset the AddOns for all of your characters, or select a character from the dropdown list to preset them only for
the selected character.
After loading into the game world the addons for the loading character will be used like defined in your list here.

2nd) Choose a character at the character selection screen and as you loaded into the game world press ESC and choose "Add-Ons"
from the menu at the left.
Changing the AddOns here will only change the AddOns and libraries for the currently logged in character!

You are able to combine both ways of changing the AddOn's state.

1st screenshot

2nd screenshot


The checkbox “Allow out of date add-ons” (2, see 1st screenshot above) was removed with the update to Blackwood! The game will just put a notification into your ingame notifications once after an API version change, if you got addons which are considered to be "out of date".

Just as an explanation how it worked and what "Out of date" means:
It was there before to enable those addons at the AddOn manager again, which are “Out of date”, and thus totally disabled (not selectable).

“Out of date” does not mean they are not working anymore!
It’s just a comparison of a value stored in the txt file of the addon/library to the currently internal in-game APIVersion (number comparison).
If the APIversion in the txt file is lower than the current APIversion, the game “assumes” the AddOn is not up2date anymore.
If anything won’t work it’s not because of this checkbox but because of the AddOns itself which might need an update.

Do NOT ask addon authors to update the addons just because they show as "out of date"! You do not know what it needs (time, ressources) to update the addons just because of this stupid version number comparison... Only 1 addon as example:
Update txt files, update lua files, create a new zip archive, upload the zip archive to esoui.com, update the changelog, update the description, update dependencies info, send the request for approval, admins have to scan the file for virus, check teh contents if any executables etc. are included, acept or decline the upload, talk to the devs if something was wrong, finally accept the upload. This all involves several ppl's free and private time, for what? For simply nothing but your own "good feeling"?
-> And now think about having to do this for ~20+ addons some devs maintain?!
Well, if you want your addons to show as not out of date you can go and manipulate the addons txt manifest file locally for yourself and set the proper ## APIVersion: in there which you are able to obtain ingame with this script in your chat edit box:
Code:
/script d(GetAPIVersion())
Be patient after major updates as there could be game changes which break a lot of AddOns at the same time.
Disable all addons and give the developers some time (days, weeks) to fix this in their free time, instead of reporting the same error
messages about non-working AddOns, directly after a patch. Thank you.

Dependency type
These dependencies can be optional, or not.
Optional dependency: Another addon or library which might be needed for the addon in question.
If the dependency is missing the addon is still able to work and can be activated in the in-game addon manager.
The AddOn might throw error messages in that case, but must not.
The optional dependency is defined via the ## OptionalDependsOn: tag in the txt files of addons.

Must dependency: Another addon or library which must be installed and enabled in the in-game
addon manager in order to enable the addon in question at all.
The AddOn will not load in total in that case.
The must dependency is defined via the ## DependsOn: tag in the txt files of addons.

Enabling/Disabling a dependency
Start the game, login, and check the in-game AddOn manager.
You are able to set the checkmark at the checkboxes to the left of the AddOn's name to enable them,
or remove the checkmark in the box to disable it again.
The in-game AddOn manager at the character selection screen got a 3rd state at these checkboxes.
The checkmark will be a filled checkbox, if you have selected the "All characters" entry from the dropdown box.
If the checkbox is filled this means "some characters got it enabled, and some got it disabled".


Missing dependencies
A missing dependency can have 2 reasons:
It is not installed at all. You need to install it like a normal AddOn as well.
It is installed but not enabled in the in-game AddOn manager.

Where do I see what dependencies an AddOn got?
It usually is written at top of the description page of an addon,
at top/inside of the changelog
or at the comments section (first comment, as sticky post) of the addon.

You can directly check the in-game AddOn manager as well.
It shows you the needed dependencies if you click on the addon name and expand it
(small right arrow icon left of the name):


If a dependency of an AddOn is missing you are able to see it directly in the in-game AddOn manager’s list,
at the right column. The text "Dependency” is indicating it.


The expanded addon will show you the details about the dependencies:
White entries are installed and enabled dependencies.
Red entries are missing dependencies!
-If the dependency is installed the text “(Disabled)” is shown next to the dependency name.
-If the dependency is totally missing (not installed yet) the text line will be simply red w/o the text “Disabled”.

Install dependencies
Logout AND close the game ESO!
Dependencies / Libraries might be not working properly if you try to install or update them as you are logged in
to the game. Better log out before installing them and close the game in order to let the in-game AddOn manager
detect all new/changed dependencies and their load-order properly after you have downloaded/updated them.

Install your dependencies via Minion
You are able to use the Minion AddOn manager to install a dependency as dependencies are AddOns as well.
Just search for them in the tool and install them via the buttons in the tool.

Manually install your dependencies
Download the named dependencies and just install them like a normal addon to your ESO AddOns folder.
Here is a description how to manually install any addon (a dependency is an AddOn as well, even if it is a library):
How do I download, extract and manually install my AddOns/dependencies/libraries



If you see dependencies in subfolders (e.g. "libs") of addons
Many older addons included the libraris in a subfolder, embedded with the addon. These libraries often cause errors today as they get loaded via the txt file of the addon "hardcoded", and thus always get loaded.

If the dependency in the subfolder (e.g. /libs/LibCustomFont/) is not given at www.esoui.com/Minion: You need to leave the library in the subfolder "libs" of the addon. But it may be causing problems and could need a fix at the addon. If the addon is not maintained any longer you might need to find an alternative! Do NOT remove the line to that dependency in the addon's txt file (see below) as it got no txt file and will not be loaded autoamtically, if not added to the txt file of the addon!

Here is a visual decision tree as a helper for you:

Steps 1 to 5 show what to do if libraries are included in subfolders and need to be removed.
Further details will be explained below now.

IF these dependencies in subfolders of your addon exist and do NOT include their own txt file of the library, e.g. subfolder is /libs/LibAddonMenu-2.0 but there is no file /libs/LibAddonMenu-2.0/LibAddonMenu-2.0.txt:
Delete the folder /libs/LibAddonMenu-2.0/ as it is outdated and will cause problems!
Edit the txt file of the addon with a text editor and remove all lines where that removed /libs/LibAddonmenu-2.0/... was mentioned.

Add line to the txt file's top, e.g. below the ## APIVersion: line:
Code:
## DependsOn: LibAddonMenu-2.0>=32
>=32 means: only enable the addon if the library version (## AddOnVersion: 32 in the libraries own txt file, e.g. LibAddonMenu-2.0.txt) 32 is given.
Reason: Older versions of LibAddonMenu-2.0 are missing the new gloal variable LibAddonMenu2 8was added with version 28, but 32 should be used for new/current addons) and thus your addon will fail to load that old library version properly!

This will add the dependency to the addon so the addon will not load (and throw errors) if the dependency is missing, or it's version is below 32.

Then just install the dependency via Minion/manually directly ONCE to your live/AddOns folder and it will be used from that folder for ALL of your addons where the ## OptionalDependency: LibAddonMenu-2.0 or ## Dependency: LibAddonMenu-2.0 was added to.

If the dependencies in the subfolder "libs" contains a txt file properly the ingame addon manager will take care of the versioning itsself, and thus this embedded library does not need to be removed.



Addons, libraries and load order of dependencies
Here is a more of a detail description what is happening with addons/libraries, their dependency and load order:


Basically the game is doing this:
1. Load and check all txt files of addons and libraries. No txt? Not found by addon manager!
Addons/Libraries txt and folder name on 1st level (live/AddOns) must match (case sensitive!) to get recognized!
2. Check ## DependsOn or OptionalDependsOn in the txt files and build a list of "load order"
3. If many same txt files, e.g. 3 LibAddonMenu-2.0.txt are found in live/AddOns (and up to 3 folder depth below in subfolders like AddonName/libs): ONLY the newest version, comparing AddOnVersion, will be loaded!
That's why libraries and other dependencies MUST use ## AddOnVersion at best to make the game handle the versioning and not even think to load any older version if a newer is found
4. If a DependsOn is missing: Addon/lib won't be loaded as dependency is missing. Attention: ONLY if DependsOn, not if OptionalDependsOn as these are optional and can be missing
5. If the DependsOn / OptionalDependsOn is adding >= after the library/Addon name, e.g. LibAddonMenu-2.0>=28, that number there is checked against that other addons/libraries txt file's tag ## AddOnVersion. In the example it would look in the LibAddonMenu-2.0.txt file and check the ## AddOnVersion to be equal or higher integer 28.
If a version only < is found: Addon/lib won't be loaded as the DependsOn is not fullfilled! Version too old.
This version check is used by the game's c code even before lua is in place! So no LibStub versioning checks any longer in lua code, but 1 addon manager thing of vanilla game.


Only bad thing that still comes within older addons, and which might make the libraries always load a "very old version", is:
Including a library in /libs/ subfolder BT do NOT include an ytxt file! Just using the addon's txt file to "hardcode load" these embedded librariies e.g.
in live/AddOns/MyAddon/MyAddon.txt there is:
/libs/LibAddonMenu-2.0/LibAddonMenu-2.0.lua
/libs/LibAddonMenu-2.0/controls/checkbox/checkbox.lua
and so on
This will make the main library file ALWAYS be loaded and if this is version 24 and was never updated, there also exists a version 34 (newest) in live/AddOns/LibAddonMenu-2.0/LibAddonMenu-2.0.txt, it might still make the whole library break and thus all dependend adodns break

So to fix this:
Remove ANY library in subfolders like /libs/ IF they are not included with their txt file properly!
If those libraies are never released on esoui here, then it might be okay to leave them inside IF they do work.
If they were released on esoui: Strip those libsin subfolders, install once the newest version to live/AddOns WITH their proper tyt file, and let it be loaded by the addon manager by enabling it there then.


Hint:
Hardcoded lines in txt files will not work anymore if the files in the subfolders are missing so thiswill silently fail then. No need to remove those lines in the addons txt file.
BUT you should add the proper ## DependsOn: LibAddonMenu-2.0>>=34 to th txt file of those addons then so it will make sure the library is loaded properly BEFORE the addon loads.



If the addon is old and still uses "LibStub" (an obsolete library for versioning)
Read here abou what LibStub was and why it was used (if interested into): https://wiki.esoui.com/Libraries
LibStub is obsolete since the Summerset update and thus should be removed from all addons. Libraries still usign LibStub should be changed to not do it anymore.

Remove the LibStub library from the "/libs" subfolder as desribed above at "If you see dependencies in subfolders...".
Check the *.lua files for the usage of the string LibStub, e.g. there could be a call to LibStub to load the library LibAddonMenu-2.0 like this:
Code:
local LAM = LibStub("LibAddonMenu-2.0")
Change the LibStub lines to use the global variable name of the library directly instead!
The global name of the library is often the same as the library name, e.g. LibMotifCategory, LibSets, LibZones.
If the library name contains a number at the end like LibAddonMenu-2.0 the global library name will just strip the - and . and numbers after the ., e.g. LibAddonMenu2.
So the line
local LAM = LibStub("LibAddonMenu-2.0") will need to change to
Code:
local LAM = LibAddonMenu2


Automatic enabling needed dependencies of addons ingame
If you have needed dependencies downloaded and installed they won't be automatically enabled if you enable an addon which uses this dependency.
But there exists the addon "Votans Addon List" which will do this for you!
Each dependency, which is needed to enable an addon, will be automatically enabled too if you enable the addon. This also means it will enable dependencies of
dependencies, like LibMapPins needs LibGPS -> Enable Addon1 which uses LibMapPins will then enable LibMapPins and it's dependency LibGPS as well.
Attention: If "Votans Addon List" is enabled the section I had explained above below "Where do I see what dependencies an AddOn got?" will slightly change:
The dependencies are not shown below the addons via the expand icon, but inline with the addon, at the right side, you'll see a colored (i) icon. Move your mouse above to see the needed dependencies in a tooltip. The color of that icon already shows you if the addon's manifest txt file says it is "Out of date" or not (green). Bt as explained above: This does not mean anything. If it works: It works!
Please read the addon's (Votans Addon List) description for firther details!

Last edited by Baertram : 07/03/23 at 11:24 AM.
  Reply With Quote

ESOUI » AddOns » AddOn Help/Support » HowTo: AddOn dependencies/Libs in Subfolder/Removal of LibStub

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