LibStub is a minimalistic versioning library embedded by thousands of other addons. It allows addons to more easily share libraries by checking for the most recent version and making it available to other installed addons.
I ask this because I’ve recently “LibStubbed” one of my libraries. So, should I choose to publish it, where or how do I register the library so that LibStub’s iterator can check it for updates? Would this be the ACE page on CurseForge?
I’ve examined the LibStub source pretty carefully, I think. Of course, I might have missed something, so let me try my question again. In the ACE documentation page for LibStub there is this statement:
An iterator over the registered major libraries.
The key word is registered.
Hence my questions.
Registered with whom?
How, or with whom, do devs register their libraries?
Registered with LibSub when the library is loaded (either as a standalone addon or embedded with another addon).
The library name (major) and revision number (minor) are registered with LibStub via NewLibary(major, minor).
The first Library with a new name(major) is returned a table to impliment their methods etc. It’s why libraries (mostly?) will have the major number as part of the name.
If another library of the same name(major) and a revision number(minor), that is less than than or equal to a previous call to NewLibrary, tries to register with LibStub it is returned a nil and does nothing further (return).
Same major and a minor that is greater than a previous registration is return the previous major table for updating (overwriting).
An addon using a library asks LibStub for the name(major) and LibStub returns the corresponing major table (containing the highest registered minor “updates”) along with the highest registered minor number.
The documented “Using Revision Control system tags for minor version” looks like it’s intended for someone using Git (or other version control system) with automated packaging/publishing.
OK, I think I understand. Revision control systems not withstanding, LibStub only knows about local libraries (i.e., running in single WoW client’s addon namespace). It’s still up to the user to use services like Curse Forge to ensure that their libraries, addons, etc., are up to date.
Correct. That is why on patch days you might see people posting about erros and the response being “download the latest version of (library x) and put it in the addon”.
But that’s the same version control that applies to all addons, hence the love of addon managers.
Automated packager(s) may also automatically get the latest libraries from Git etc. when run but not my area of expertise.