Thread Tools Display Modes
09/22/19, 07:48 PM   #1
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,912
Please do NOT include libraries without own txt file (where possible)

Information for addon developers
Hello devs,

I often find addons here on esoui which include libraries in a subfolder (like /libs).
This is common and no problem as long as you include the libraries with their own txt file (if they got one)!
If the library got no own txt file you could check if you can add one and publish the library as standalone here on esoui.com.
If this is not possible or the lib is only used in your few addons, you can include and load them from your addon's txt file.

If you just load them from your addon's txt file without adding them to your addon's txt ## OptionalDependsOn: or ## DependsOn: they will most likely break one day.

-More information about the libraries and the included libs can be read here-

So if you include the libraries please do the following:
  1. Where possible: Do not load them from your addon's txt file like this: e.g. /libs/LibAddonMenu-2.0/controls/editbox.lua
  2. Instead include the total library from the downloaded lib's zip archive, including it's own txt file (which hopefully contains the ## IsLibrary: true and the ## AddOnVersion: tags)
  3. Add the libraries your addon needs to the ## DependsOn: tag (or the ## OptionalDependsOn: tag if it's only optional)
  4. Do NOT use LibStub anymore to load the libraries, where not needed. LibStub is obsolete since Summerset patch and you should update the libraries to not use it anymore.
  5. If the library you want to use does not contain an own txt file: Tell the developer of the library to update it and provide a txt file please. If this is not done, you may include the library in your addon#s "libs" subfolder e.g. and call it via hardcoded lines from your addon. But the better way would be to maybe update the library with a patched version, or if the author is not playing anymore, claim the library and update it by yourself officially then. Ask "Dolby" or "Cairenn" here in the forums to add you to the team AFTER talking to the author and asking for permission.

This will assure that only the newest version of the library wil lbe loaded ingame.
And it will help to reduce errors because of "hardcoded calls to outdated libraries".

LibStub is obsolete:
LibStub will be gone one day as the ## AddOnVersion: tag can be used since the Summerset patch already.
Most libraries work without, and still with LibStub already.
Some were changed to only support their own global variable and NOT LibStub anymore (e.g. the wide spread addon menu library "LibAddonMenu-2.0" was just changed to strip LibStub).

Please check your addons on next update if you can replace calls to LibStub from e.g.
Code:
local LAM = LibStub("LibAddonMenu-2.0")
to the global variable usage:
Code:
local LAM = LibAddonMenu2>=28
The global variable names are mentioned in the library description or changelog.

Version check for needed dependencies:
The >= means "only allow versions equal or newer to".
28 was the version where the global LibAddonMenu2 variable was added to the librray.
The version number can be found inside the libraries' own txt file, tag
## AddOnVersion: <integerVersionNumber>

This >= can be used at the ## DependsOn: and the ## OptionalDependsOn: tags.

Information for addon users
What if my addon is very outdated and noone will update it anymore?
I'd first search for a working replacement.
Or ask someone to fix the addon for you.

Or you can try to fix it yourself.
Search the folder and subfolder of the addon for "libs" or "libraries" or any similar folders.
In there there might be used dependencies/libraries, but without an own txt file of that library.
I'd do the following:
Make a list of the libraries in the subfolder "libs"/"libraries" or similar.
Then move ALL subfolders in this "libs"/"libraries" folder away, totally outside of your elder scrolls/live/addons folder (e.g. to c:\backup).
Check the name of the libraries that were included into the addon and search them at www.esoui.com, download the newest version.
Install it into your AddOns folder directly/via Minion.

Once installed check if the library installed to your AddOns folder got an own txt file, e.g. LibAddonMenu-2.0.txt.
If so: All is fine, the addon manager will find them there.
If not: Copy this library into the addon's same subfolder (e.g. "libs") where it was before, in order to have the newest version.


Afterwards do for each library which you have checked, removed, reinstalled/updated like above:

If the library got it's own txt file:

Search the txt file of the "addon" (not the libraries!!!) for these entries
## DependsOn: <libraryName1> <libraryName2>
or
## OptionalDependsOn: <libraryName1> <libraryName2> <addonName1>

Copy & paste the filename of the libraries' txt file, without the .txt extension (e.g. "LibAddonMenu-2.0.txt" -> Copy "LibAddonMenu-2.0")
to the ## DependsOn: line, at the end, after existing entries, sperated via a SPACE.
e.g. line was before:
## DependsOn: LibFilters-3.0

Line after your update:
## DependsOn: LibFilters-3.0 LibAddonMenu-2.0>=31
The >= is mentioned and described above (at "Information for addon developers" -> "Version check for needed dependencies") and is different for EACH library, so check these libraries txt files for the most up2date ## AddOnVersion tag, to be sure you add the correct numbers. Or do not use the >= integer addition at all.

If the ## DependsOn: line already included the same library name you do not need to add it again!

After that check the txt file of the AddOn (not the libraries!!!) for "hardcoded library lines" with the same library name you have just added as ## DependsOn (in our example LibAddonMenu-2.0). They look like this:
/libs/LibAddonMenu-2.0/controls/editbox.lua or
/libs/LibAddonMenu-2.0/LibAddonMenu-2.0/LibAddonMenu-2.0.lua

Remove ALL the hardcoded lines of the libraries that were just added to the ## DependsOn or ## OptionalDependsOn!
The ## DependsOn or ## OptionalDependsOn willa ssure the ZOs addon manager ingame will find the libraries via their own txt files properly, AND will only load the bewest version (via the ## AddOnVersion: tag) once.

Exception:
If the library does not provide it's own txt file, the addon manager ingame won't be able find them. This is why some of the libs need to be loaded via these "hardcoded lines" from the addon's txt file.
So leave the lines in/untouched for the libraries you have found/updated before, where there is no own txt file in the libraries' folder!
Or maybe ask the library author to update and release a version WITh it's own txt file (would be best imo).

For more library related technical information you can read this WIKI entry:
https://wiki.esoui.com/Libraries

Last edited by Baertram : 03/14/21 at 12:50 PM.
  Reply With Quote
09/23/19, 10:17 AM   #2
Anceane
 
Anceane's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2014
Posts: 306
When i have this in a configmenu.lua, do i need to change it too ? (i corrected the .txt, the call in in the main lua, but i dont know about this one part


Code:
local LAM = LibStub( 'LibAddonMenu-2.0', true )
local LMP = LibStub( 'LibMediaProvider-1.0', true )

if ( not LAM ) then return end
if ( not LMP ) then return end

My basic understanding would be to do :


Code:
local LAM = LibAddonMenu-2.0
local LMP = LibMediaProvider-1.0

if ( not LAM ) then return end
if ( not LMP ) then return end
Thank you
  Reply With Quote
09/23/19, 12:10 PM   #3
Rhyono
AddOn Author - Click to view addons
Join Date: Sep 2016
Posts: 659
For LAM: look at how Baertram did it. You almost had it correct.

For LMP: no, it hasn't been setup to work without LibStub.
  Reply With Quote
09/24/19, 01:56 AM   #4
Anceane
 
Anceane's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2014
Posts: 306
Originally Posted by Rhyono View Post
For LAM: look at how Baertram did it. You almost had it correct.

For LMP: no, it hasn't been setup to work without LibStub.
Then i guess i better do nothing, as i dont see why i should remove libstub in one case and have to keep it in another.

Best is probably to wait for Authors to decide what they want to do first with Libstub

And btw, the addon i wanted to check is a very old one : https://www.esoui.com/downloads/info...dandjpFix.html

This is actually my principal addon, without it i would not be able to read correctly the game
  Reply With Quote
09/24/19, 06:56 AM   #5
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,912
LibStub is still working and some libraries are still not changed to work without it.
So you can prepare addons and libs to not use LibStub anymore where applicable, or what until it's gone and let them fail to load properly then.

Currently it's only an advice to make addons work with or without it. You can even load the library via LibStub as long as it is given and if LibStub == nil then use the global variable instead (hybrid solution).

Originally Posted by Anceane View Post
Then i guess i better do nothing, as i dont see why i should remove libstub in one case and have to keep it in another.

Best is probably to wait for Authors to decide what they want to do first with Libstub

And btw, the addon i wanted to check is a very old one : https://www.esoui.com/downloads/info...dandjpFix.html

This is actually my principal addon, without it i would not be able to read correctly the game
  Reply With Quote
09/25/19, 09:22 AM   #6
ArtOfShred
 
ArtOfShred's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2016
Posts: 103
Originally Posted by Rhyono View Post
For LAM: look at how Baertram did it. You almost had it correct.

For LMP: no, it hasn't been setup to work without LibStub.
LMP should work fine without LibStub, just use
Code:
local LMP = LibMediaProvider
if not LMP then return end
LMP has LibStub implemented in the same way as LAM right now, just embedded in the folder w/o a manifest for compatibility.
  Reply With Quote

ESOUI » Developer Discussions » General Authoring Discussion » Please do NOT include libraries without own txt file (where possible)

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