-
Notifications
You must be signed in to change notification settings - Fork 9
How to Use
Rainrider edited this page Jun 26, 2017
·
7 revisions
LibArtifactData-1.0 can be either embedded or used as a stand-alone library.
Make sure you add LibArtifactData-1.0 to the ##OptionalDeps
field in your addon's ToC.
- Add the following under externals in your
.pkgmeta
file:
libs/LibStub:
url: https://repos.wowace.com/wow/libstub/trunk
tag: latest
libs/CallbackHandler-1.0:
url: https://repos.wowace.com/wow/callbackhandler/trunk/CallbackHandler-1.0
tag: latest
libs/LibArtifactData-1.0:
url: https://github.com/Rainrider/LibArtifactData-1.0.git
tag: latest
- Add the following in your addon's ToC file:
## OptionalDeps: LibArtifactData-1.0
#@no-lib-strip@
libs\LibStub\LibStub.lua
libs\CallbackHandler-1.0\CallbackHandler-1.0.lua
libs\LibArtifactData-1.0\LibArtifactData-1.0.lua
#@end-no-lib-strip@
The #@no-lib-strip@
and @end-no-lib-strip@
tags are not required if you do not use disembedded packaging for your addon. For more details see the .pkgmeta documentation
- get a copy of LibStub.lua, CallbackHandler.lua and LibArtifactsData-1.0.lua and place them in your addons folder.
- make sure LibStub.lua and CallbackHandler-1.0.lua are loaded prior to LibArtifactData-1.0.lua.
Simple example:
local name, addon = ...
local LAD = LibStub("LibArtifactData-1.0")
function addon:ARTIFACT_ADDED(message, artifactID)
local id, data = LAD:GetArtifactInfo(artifactID)
print(id == artifactID, data.name)
end
LAD.RegisterCallback(addon, "ARTIFACT_ADDED")
Please read the API, Events and Data structure documentation for further details.