Thread Tools Display Modes
Prev Previous Post   Next Post Next
02-25-20, 01:48 PM   #1
Sweetsour
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Dec 2014
Posts: 130
Ace3 DB Profile not copying over existing values

Hello!

I'm trying to finish up my addon with adding profile functionality and I'm pretty sure it's almost good too. The only issue is when I use the copy profile functionality, the values from the profile I'm trying to copy from aren't being applied to the profile of the character that's currently logged in.

core.lua
Lua Code:
  1. function Ace3:OnInitialize()
  2.     local about_panel = LibStub:GetLibrary("LibAboutPanel", true)
  3.  
  4.     if about_panel then
  5.         self.optionsFrame = about_panel.new(nil, "AutoTracker")
  6.     end
  7.  
  8.     self.db = LibStub("AceDB-3.0"):New("ATP_db", ATP.defaults, true)
  9.  
  10.     self.db.RegisterCallback(self, "OnNewProfile", "OnProfileUpdate")
  11.     self.db.RegisterCallback(self, "OnProfileChanged", "OnProfileUpdate")
  12.     self.db.RegisterCallback(self, "OnProfileCopied", "OnProfileUpdate")
  13.     self.db.RegisterCallback(self, "OnProfileReset", "OnProfileUpdate")
  14.    
  15.     self:SetupOptions()
  16.  
  17.     self.myname = UnitName("player")
  18.     self.myrealm = GetRealmName()
  19. end

config.lua
Lua Code:
  1. function Ace3:SetupOptions()
  2.     local ACFG = LibStub("AceConfigRegistry-3.0")
  3.     local ACD = LibStub("AceConfigDialog-3.0")
  4.    
  5.     ACFG:RegisterOptionsTable("AutoTracker Profiles", LibStub("AceDBOptions-3.0"):GetOptionsTable(self.db,true))
  6.     ACD:AddToBlizOptions("AutoTracker Profiles", "Profiles", "AutoTracker")
  7. end

defaults.lua
Lua Code:
  1. local ATP, Ace3, LSM = unpack(select(2,...))
  2.  
  3. local defaults = {
  4.     profile = {
  5.         continents = {
  6.             -- table contents
  7.         },
  8.     },
  9.     char = {
  10.         continents = {
  11.             -- table contents
  12.         },
  13.     }
  14. }
  15.  
  16. ATP.defaults = defaults

Any ideas?

Last edited by Sweetsour : 02-25-20 at 08:37 PM. Reason: added defaults.lua contents
  Reply With Quote
 

WoWInterface » Developer Discussions » Lua/XML Help » Ace3 DB Profile not copying over existing values


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