Skip to content
Kyle Buller edited this page Jul 27, 2018 · 2 revisions

Quick Tutorial

Profile support

LibDualSpec-1.0 relies on AceDB-3.0 profile switching feature. Thus, before using this library, you should ensure your addon gracefully handles "online" profile switching. This often means handling AceDB-3.0 profile callbacks.

Embedding LibDualSpec-1.0

Either copy the LibDualSpec-1.0.lua file in your addon folder or use the Curse packager features.

Reference the library in your .pkgmeta file

externals:
   libs/LibDualSpec-1.0:
    url: https://repos.wowace.com/wow/libdualspec-1-0
    tag: latest

Reference the library in your TOC file

# OptionalDeps: LibDualSpec-1.0
#@no-lib-strip@
libs\LibDualSpec-1.0\LibDualSpec-1.0.lua
#@end-no-lib-strip@

Enabling LibDualSpec-1.0

And finally, in your addon, enhance your AceDB-3.0 database and optionally the profile options created by AceDBOptions-3.0:

function myAddon:OnInitialize()
  -- Initialize the AceDB-3.0 database
  self.db = LibStub('AceDB-3.0'):New("myAddonDB", myDefaults)

  -- Create the profile options and add them to our option table
  self.options.args.profiles = LibStub('AceDBOptions-3.0'):GetOptionsTable(self.db)

  -- Add dual-spec support
  local LibDualSpec = LibStub('LibDualSpec-1.0')
  LibDualSpec:EnhanceDatabase(self.db, "myAddon")
  LibDualSpec:EnhanceOptions(self.options.args.profiles, self.db)
end