View Single Post
05/27/19, 08:41 AM   #28
Enodoc
AddOn Author - Click to view addons
Join Date: Aug 2014
Posts: 52
Originally Posted by sirinsidiator View Post
As an author, you switch away from the LibStub embedded way of adding source files to your own manifest. Instead you should use DependsOn for libraries that have to be loaded and OptionalDependsOn for libs that may be loaded. In any case you will have to check the library if it has been updated to support this.

Once you have done that, you can decide for yourself if you still want to bundle the libs with your addon, or have the users install them separately. Having them installed separately will cause less problems in the future (in case another addon is depending on a newer version of the lib, but doesn't have it bundled) and you won't have to update the bundled libs yourself any more. It also has slightly better performance (less folders to scan for the game), but that's likely only in the ms-range.
OK cool thanks. So just to check that I understand correctly - in terms of LAM, which is obviously the primary example that I know has already been updated:

The library in question needs to have its own manifest txt file, which must include:
Code:
## IsLibrary: true

The individual add-on's manifest txt file needs to change from:
Code:
## OptionalDependsOn: LibStub LibAddonMenu-2.0

Libs/LibStub/LibStub.lua
Libs/LibAddonMenu-2.0/LibAddonMenu-2.0.lua
Libs/LibAddonMenu-2.0/controls/panel.lua
...

AddOn.lua
to:
Code:
## DependsOn: LibAddonMenu-2.0

AddOn.lua

And the add-on code itself needs to change from:
lua Code:
  1. local LAM = LibStub("LibAddonMenu-2.0")

to:
lua Code:
  1. local LAM = LibAddonMenu-2.0

Then the library could or could not be bundled in the add-on directory, and the game will load it from the add-on or from standalone depending on which is the most recent version.

Is that everything in summary? Thanks!
  Reply With Quote