Thread Tools Display Modes
09/28/21, 02:51 AM   #1
ApoAlaia
Join Date: Nov 2020
Posts: 6
What is considered 'best practice' when it comes to embedded libraries

Good morning beautiful people,

I am in the process of both 'thinning the crowd' and also troubleshooting some really peculiar behaviour when it comes to addons and I find myself wondering what the title says.

An example would be:

Awesome Guild Store: it has LibStub, CustomTitles, LAUNIG embedded.

Some of those are also embedded in other addons I use and they are also required by yet more addons that do not have them embedded.

This means that in some cases I might end up with three or more copies of the same library.

What would be the best practice in this case?

Remove the embedded libraries from the addons and use that standalone versions?

Keep just one copy of the embedded libraries, remove the other embedded ones and do not install the standalone ones?

Keep all the embedded libraries but do not install standalone ones?

I am trying to cut on loading times and also try to work out why I get this strange behaviour on some addons - which will work fine one session, then next session only partially work, and so on and so forth - so the more I can simplify the better.

Thanks!

EDIT: I don't even know if is feasible to remove these embedded libraries, haven't gotten as far yet.

Last edited by ApoAlaia : 09/28/21 at 03:48 AM.
  Reply With Quote
09/28/21, 03:26 PM   #2
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,912
>Remove the embedded libraries from the addons and use that standalone versions
Yes
But only if the libraries provide their own txt file!
AddOns provide the info the ingame addon manager needs via the txt files and the tags in it, like ## Addon Version to only load the newest version of the library.

If the lib does not have an own txt file (and I do not mean in the subfolder of the addons but the Library itself, here at esoui / in Minion) it might never had one and thus you need to keep it in the subfolder where it gets called by the txt file in the main folder of the addon (hard-coded call from the addon's txt file, not the library's txt file).

But in that case you should always make sure to download the newest version from esoui! Replace the files in the subfolder of the addons (e.g. /libs/CustomTitles) with the newest downloaded files.
If the library got an onw txt file on esoui/Minion you should delete the subfolders in other addons AND ONLY install that lib ONCE into your live/AddOns folder so that Minion detects it and keeps it updated. This is the very best practice.

Last edited by Baertram : 09/29/21 at 03:59 AM.
  Reply With Quote
09/28/21, 03:28 PM   #3
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,912
Read here about libraries, how they work, how they are loaded and what different types to load (non-included into addons: Best! Included into addons: Either with their own txt file: 2nd BEST, or without an txt file hardcoded from the addon's main folder txt file: Very much troubling as always loaded even if old and broken! Do not use this anymore if not explicitly needed by that library -> and 99% do not need this. CustomTitles does not provide an own txt file so it will need these hardcoded calls. So you need to update the versions in your subfolders to use the newest one, which you need to download then and overwrite in your subfolders of your addons where it is used).

https://wiki.esoui.com/Libraries

Basically libs load by the ingame addon manager once with the newest version IF they provide their own txt file.

If they do not provide a txt file they will be loaded like other addons from the main txt file of the addon, where the lua/xml files of the lib are named hard-coded. This most likely will make your addons fail and error as the files are ALWAYS loaded (no matter how old they are).

LibStub was the old obsolete way to load only the newest version of a lib. But it loads all older versions given as well, only overwrites them with newer ones.

So the current best way is to use the txt files, AddOnVersion and IsLibrary attributes to load only 1 version (the newest). And maybe update my libs to get a txt file.

Btw load times will not decrease significantly if you remove some of the files. The savedvariables, especially big ones, are the load time increasers.

Last edited by Baertram : 09/29/21 at 04:01 AM.
  Reply With Quote
09/29/21, 03:38 AM   #4
ApoAlaia
Join Date: Nov 2020
Posts: 6
Thanks a lot for the informative replies, much appreciated.

I had a feeling that addons with large 'databases' (so to speak) would be the ones causing the long-ish loading times.

Fortunately there is already an addon - funny that made available by yourself - that can help me with that conundrum by means of letting me create 'Addon Packs'.

At the moment is... well, depending on how I tackle it a more or less but still involved process to select which addons I want for a given session.

For instance doing writs comfortably involves precious - but invaluable - few addons, and because of the multiplication factor (currently 24 characters) loading times do add up.

You addon cuts down significantly the hassle factor; no more renaming folders (and the opportunity for mistakes to slip in) or endlessly ticking/unticking boxes.

Either way I will check the documentation you have linked and see if I can get somewhere with the current inconsistencies that I'm experiencing.

Last edited by ApoAlaia : 09/29/21 at 04:03 AM.
  Reply With Quote
09/29/21, 06:55 PM   #5
Sharlikran
 
Sharlikran's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 626
Originally Posted by ApoAlaia View Post
Q. What would be the best practice in this case?
A. Remove the embedded libraries from the addons and use that standalone versions.

EDIT: I don't even know if is feasible to remove these embedded libraries, haven't gotten as far yet.
Where the issue lies is in your ability and skill to make minor changes to the Lua files for older mods that may still work with the current version of ESO. The most common and most basic change is.

If you find
Code:
local LAM = LibStub( 'LibAddonMenu-2.0')
local LCM = LibStub( 'LibCustomMenu')
Change to
Code:
local LAM = LibAddonMenu2
local LCM = LibCustomMenu
Other then that it can become more involved. Probably the safest way is to see what embedded libraries there are. If you find LibCustomMenu and LibAddonMenu-2.0 those are pretty safe to remove. When you do then you only need to look for the LibStub lines that load either of those Addons and change it.

If you have to get fancier then that you may run into situations where you break the mod unless you can figure it out.
  Reply With Quote
09/30/21, 01:07 AM   #6
ApoAlaia
Join Date: Nov 2020
Posts: 6
Originally Posted by Sharlikran View Post
Where the issue lies is in your ability and skill to make minor changes to the Lua files for older mods that may still work with the current version of ESO. The most common and most basic change is.

If you find
Code:
local LAM = LibStub( 'LibAddonMenu-2.0')
local LCM = LibStub( 'LibCustomMenu')
Change to
Code:
local LAM = LibAddonMenu2
local LCM = LibCustomMenu
Other then that it can become more involved. Probably the safest way is to see what embedded libraries there are. If you find LibCustomMenu and LibAddonMenu-2.0 those are pretty safe to remove. When you do then you only need to look for the LibStub lines that load either of those Addons and change it.

If you have to get fancier then that you may run into situations where you break the mod unless you can figure it out.
One could say that you have to break it to figure it out no?

At least for plebs like myself that is often the case. Just keep breaking what someone more skilled or more talented (often both) has made until one figures it out.

Either way I appreciate the replies, thanks
  Reply With Quote
09/30/21, 01:24 AM   #7
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,912
Well to be true, we do it the very same way if it's not our code/addon
We just know a bit more about the background and would be able to search for "help" and "how did ZOs code it in their game files" more easily then.

Originally Posted by ApoAlaia View Post
One could say that you have to break it to figure it out no?

At least for plebs like myself that is often the case. Just keep breaking what someone more skilled or more talented (often both) has made until one figures it out.

Either way I appreciate the replies, thanks
  Reply With Quote
09/30/21, 07:58 AM   #8
Sharlikran
 
Sharlikran's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 626
Originally Posted by ApoAlaia View Post
One could say that you have to break it to figure it out no?

At least for plebs like myself that is often the case. Just keep breaking what someone more skilled or more talented (often both) has made until one figures it out.

Either way I appreciate the replies, thanks
just in case something was lost in translation, I wasn't saying you were a pleb as you put it.
  Reply With Quote
10/04/21, 02:40 AM   #9
ApoAlaia
Join Date: Nov 2020
Posts: 6
Originally Posted by Sharlikran View Post
just in case something was lost in translation, I wasn't saying you were a pleb as you put it.
Apologies, I didn't imply that you did, is just how I feel about these things.

On a good day I feel ordinary, on a bad one mediocre.
  Reply With Quote

ESOUI » AddOns » AddOn Help/Support » What is considered 'best practice' when it comes to embedded libraries

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