Thread Tools Display Modes
08-18-24, 08:54 PM   #1
cx199541005
A Defias Bandit
Join Date: Aug 2024
Posts: 3
Question How do multiple instances of LibSharedMedia or sharedmedia in different subdirectorie

As the title suggests, I've always been curious about this issue.

Many addons now bundle libraries like lib or Ace within their own directories, while I also have these libraries installed in the root “Interface\AddOns\” directory. When the code differs between these instances, how does the game handle it?

For example, let's say :
I add a line of code to the standalone installation of LibSharedMedia-3.0 located at “...\Interface\AddOns\LibSharedMedia-3.0\LibSharedMedia-3.0\LibSharedMedia-3.0.lua” to register a custom font.
Now, other addons I have installed like ElvUI, BigWigs, MSBT, and Plater also include their own copies of LibSharedMedia-3.0.lua. Do I need to modify each of these as well?

When the lib addon registers my custom font with the client, does each addon prioritize reading its own LibSharedMedia-3.0.lua file first, or does it prioritize the one in the root directory?
  Reply With Quote
08-18-24, 09:21 PM   #2
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,974
You end up with one global instance of LSM (major version) that shares a single db of all media registered with it by all addons. That is essentially what LibStub does being the central contoller of libraries that register with it and addons that "get" libraries from it.
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

Last edited by Fizzlemizz : 08-18-24 at 09:33 PM.
  Reply With Quote
08-18-24, 10:09 PM   #3
cx199541005
A Defias Bandit
Join Date: Aug 2024
Posts: 3
This reply was sent to the wrong recipient and has been deleted.

Last edited by cx199541005 : 08-18-24 at 10:12 PM.
  Reply With Quote
08-18-24, 10:10 PM   #4
cx199541005
A Defias Bandit
Join Date: Aug 2024
Posts: 3
Originally Posted by Fizzlemizz View Post
You end up with one global instance of LSM (major version) that shares a single db of all media registered with it by all addons. That is essentially what LibStub does being the central contoller of libraries that register with it and addons that "get" libraries from it.
Thank you for your reply!
It seems like these kinds of addons follow a "union of sets" approach, meaning that no matter how many different Lua files exist at various levels, every single entry ultimately gets aggregated and registered. Is that correct?
  Reply With Quote
08-18-24, 10:24 PM   #5
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,974
Just open a copy of LibStub.lua and you can see exactly how the libraries are being managed. It's 30 lines of code including comments and blanks.
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » AddOn Help/Support » How do multiple instances of LibSharedMedia or sharedmedia in different subdirectorie


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