Quantcast AceDB Resetting - WoWInterface
Thread Tools Display Modes
08-07-16, 10:11 PM   #1
MilleXIV
A Deviate Faerie Dragon
 
MilleXIV's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2016
Posts: 16
AceDB Resetting

Started having an issue earlier where AceDB wasn't keeping my settings, however my SavedVariables are saving right. Was wondering if anybody has encountered this before. I'm using AceConfig with a dropdown to choose between "BOTTOM" and "TOP". When I do the call to Refresh() it changes correctly, but after a UIReload it goes back to the BOTTOM.

TOC Information:
Lua Code:
  1. ## SavedVariables: TEST_CONFIG, XIVBarDB

Here's how I'm initiating the DB (in AddOn:OnInitialization):
Lua Code:
  1. self.db = LibStub("AceDB-3.0"):New("XIVBarDB", self.defaults)

Here's the defaults:
Lua Code:
  1. XIVBar.defaults = {
  2.   profile = {
  3.     general = {
  4.       barPosition = "BOTTOM",
  5.     },
  6.     color = {
  7.       barColor = {
  8.         r = 0.25,
  9.         g = 0.25,
  10.         b = 0.25,
  11.         a = 1
  12.       },
  13.       normal = {
  14.         r = 0.8,
  15.         g = 0.8,
  16.         b = 0.8,
  17.         a = 0.75
  18.       },
  19.       inactive = {
  20.         r = 1,
  21.         g = 1,
  22.         b = 1,
  23.         a = 0.25
  24.       },
  25.       useCC = true,
  26.       hover = {
  27.         r = 1,
  28.         g = 1,
  29.         b = 1,
  30.         a = 1
  31.       }
  32.     },
  33.     text = {
  34.       fontSize = 12,
  35.       smallFontSize = 11,
  36.       font =  L['Homizio Bold']
  37.     },
  38.     modules = {
  39.  
  40.     }
  41.   }
  42. };

SavedVariables:
Lua Code:
  1. XIVBarDB = {
  2.     ["profileKeys"] = {
  3.         ["Chiasmae - Zul'jin"] = "Chiasmae - Zul'jin",
  4.     },
  5.     ["profiles"] = {
  6.         ["Chiasmae - Zul'jin"] = {
  7.             ["general"] = {
  8.                 ["barPosition"] = "TOP",
  9.             },
  10.         },
  11.     },
  12. }

Here's how I'm setting it in my AceConfig options:
Lua Code:
  1. set = function(info, value) self.db.profile.general.barPosition = value; self:Refresh(); end,

Here's how I'm using it (in Addon:Refresh):
Lua Code:
  1. self.frames.bar:SetPoint(self.db.profile.general.barPosition)

EDIT:
For reference, full source: https://github.com/MilleXIV/XIV_Databar/tree/ace-rework and commit it broke after: https://github.com/MilleXIV/XIV_Data...214a286bc1840b.

Last edited by MilleXIV : 08-08-16 at 09:37 AM.
  Reply With Quote
08-08-16, 01:43 AM   #2
myrroddin
A Pyroguard Emberseer
 
myrroddin's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 1,109
Call AddOn:Refresh() in your AddOn:OnInitialize() section, after setting up your SVs.
  Reply With Quote
08-08-16, 06:08 AM   #3
MilleXIV
A Deviate Faerie Dragon
 
MilleXIV's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2016
Posts: 16
Originally Posted by myrroddin View Post
Call AddOn:Refresh() in your AddOn:OnInitialize() section, after setting up your SVs.
Hmm, the first time I call AddOn:Refresh() is during AddOn:OnEnable() so it's definitely after the SVs get loaded. I'm even having this issue when I move initiating the DB up to the first line of AddOn:OnInitialize().

Full source is found at https://github.com/MilleXIV/XIV_Databar/tree/ace-rework if it would help anybody.
  Reply With Quote
08-08-16, 06:51 AM   #4
myrroddin
A Pyroguard Emberseer
 
myrroddin's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 1,109
Okay, before I go deeper into your initial problem, here's some feedback:
  1. Having a global variable named "P" is near catastrophic. Make that a local variable.
  2. With LibSharedMedia, do not localize the media name. It won't be localized for anyone who is using a different AddOn than the one you are writing, and will most likely break LSM for other users.
  3. Get rid of embeds.xml. It was only used years ago by the AceUpdater, which is long defunct. Plus your ToC is loading a file, which in turn is loading more files. Just put all your library lookups directly into the ToC.
  4. There is no need to localize the word "Profiles"; AceConfig will do that for you.
  5. Move the creation of self.frames from OnEnable to OnInit. You only need to create the table once.
I'm sure there is more, and what I mentioned doesn't fix your actual problem, but it's a start.
  Reply With Quote
08-08-16, 07:22 AM   #5
MilleXIV
A Deviate Faerie Dragon
 
MilleXIV's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2016
Posts: 16
Originally Posted by myrroddin View Post
Okay, before I go deeper into your initial problem, here's some feedback:
  1. Having a global variable named "P" is near catastrophic. Make that a local variable.
  2. With LibSharedMedia, do not localize the media name. It won't be localized for anyone who is using a different AddOn than the one you are writing, and will most likely break LSM for other users.
  3. Get rid of embeds.xml. It was only used years ago by the AceUpdater, which is long defunct. Plus your ToC is loading a file, which in turn is loading more files. Just put all your library lookups directly into the ToC.
  4. There is no need to localize the word "Profiles"; AceConfig will do that for you.
  5. Move the creation of self.frames from OnEnable to OnInit. You only need to create the table once.
I'm sure there is more, and what I mentioned doesn't fix your actual problem, but it's a start.
Good feedback. This is my first time using the Ace libraries so I'm still getting used to them.
  1. Good catch, didn't even realize I had left it global
  2. That was more a weird preference for not having output strings in the middle of code, but considering how AceLocale works, that was basically useless
  3. Is there any disadvantage to using embeds.xml other than the file loading overhead? I like the idea of keeping my libraries listed in one separate file
  4. Huh, I was not aware it did that. Good to know.
  5. Fixed. How often is OnEnable called? Should I worry about it running too often?
  Reply With Quote
08-08-16, 07:39 AM   #6
myrroddin
A Pyroguard Emberseer
 
myrroddin's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 1,109
OnInitialize() is called once, during AddOn startup. Think of it as a very fancy wrapper for ADDON_LOADED, because, among other things, you do not need to weed out all the other AddOns to find yours.

OnEnable() and OnDisable() are called whenever your AddOn is enabled or disabled. In your defaults table, if you have a variable that flags the AddOn as enabled (call it enabled, or enabledAddOn, or Tony) "true", you can then, in OnInit, after setting up the SVs, call
Code:
self:SetEnabledState(self.db.profile.enabled)
If the value is true, then OnEnable() will run immediately after OnInit(), otherwise, OnDisable() will be called. In your options table, it would look like this:
Code:
enabled = {
    order = 10,
    type = "toggle",
    name = ENABLE, -- use Blizzard's globalstring
    get = function() return self.db.profile.enabled end,
    set = function(_, value)
        self.db.profile.enabled = value
        if value then
            self:OnEnable()
        else
             self:OnDisable()
        end
    end
}
  Reply With Quote
08-08-16, 07:45 AM   #7
myrroddin
A Pyroguard Emberseer
 
myrroddin's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 1,109
About your profiles, here's another tip. You don't even need to have the word "Profiles" at all. Again, Ace3 will do stuff automatically for you. The second line is optional. I have it because I want my Profiles tab to be the last tab, and since I have 5 tabs in my options table, setting the order to 90 ensures that.
Code:
options.args.profiles = LibStub("AceDBOptions-3.0"):GetOptionsTable(self.db)
options.args.profiles.order = 90
  Reply With Quote
08-08-16, 08:11 AM   #8
myrroddin
A Pyroguard Emberseer
 
myrroddin's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 1,109
Here is some more stuff.
  1. Your ToC is missing CallbackHandler-1.0. It should be listed immediately after LibStub, and without it, most of the Ace3 libs won't work, including AceEvent and AceDB.
  2. I didn't verify, but the load order of Ace3 libraries is important. Cross-reference with the Ace3 ToC to make sure the are in the correct order in your ToC.
More changes:
Code:
local L = LibStub("AceLocale-3.0"):GetLocale(AddOnName, true) -- true, not false

-- doesn't need to be a subtable of XIVBar
local defaults = {
}
Your arguments in your options table are wrong. There are no such entries as general, text, or textColors. You are also missing the order field.
  Reply With Quote
08-08-16, 08:14 AM   #9
myrroddin
A Pyroguard Emberseer
 
myrroddin's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 1,109
https://www.wowace.com/addons/ace3/p...ptions-tables/
  Reply With Quote
08-08-16, 08:29 AM   #10
Torhal
A Pyroguard Emberseer
 
Torhal's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2008
Posts: 1,196
Originally Posted by MilleXIV View Post
Good feedback. This is my first time using the Ace libraries so I'm still getting used to them.

Is there any disadvantage to using embeds.xml other than the file loading overhead? I like the idea of keeping my libraries listed in one separate file
None. I so the same, for the same reason. I don't know why, but for the few projects I have where I load everything from the ToC, I will almost always forget to add/remove something when I change my libraries.
__________________
Whenever someone says "pls" because it's shorter than "please", I say "no" because it's shorter than "yes".

Author of NPCScan and many other AddOns.
  Reply With Quote
08-08-16, 08:31 AM   #11
MilleXIV
A Deviate Faerie Dragon
 
MilleXIV's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2016
Posts: 16
Okay, lots of feedback there.
  1. What's the benefit to forcing my addon to call OnEnable itself versus waiting for it to be called automatically?
  2. Will have to try out that way of adding the profiles.
  3. Will definitely have to enable CallbackHandler.
  4. I haven't found anything wrong with the general/text/textColors portion of my options table? In fact, that part of it is working exactly as I intended. They're subgroups of the initial group, as per the groups documentation. The functions that get called return the group tables.
  Reply With Quote
08-08-16, 08:44 AM   #12
myrroddin
A Pyroguard Emberseer
 
myrroddin's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 1,109
You can also look at Blizzard's globalstrings.lua to see if there is any words or phrases they have already translated. For example, do a search for "general options" and look what you find.

Replace all instances of L["General"] with COMPACT_UNIT_FRAME_PROFILE_SUBTYPE_ALL as one example.

Also, in your localization file for enUS.lua, delete if not L then return; end –– afterall, this is your default localization. If someone playing on deDE loaded your AddOn, absolutely zero text would be displayed except of any globalstrings. The beginning of enUS.lua should look like this.
Code:
local AddOnName, Engine = ...;
local L = LibStub("AceLocale-3.0"):NewLocale(AddonName, "enUS", true, false)

L['Text'] = true
-- etc
Speaking of localization, change this line in core.lua
Code:
local L = LibStub("AceLocale-3.0"):GetLocale(AddOnName, false)

-- should be thusly
local L = LibStub("AceLocale-3.0"):GetLocale(AddOnName, true)
  Reply With Quote
08-08-16, 08:54 AM   #13
myrroddin
A Pyroguard Emberseer
 
myrroddin's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 1,109
Originally Posted by MilleXIV View Post
  1. What's the benefit to forcing my addon to call OnEnable itself versus waiting for it to be called automatically?
  2. Will have to try out that way of adding the profiles.
  3. Will definitely have to enable CallbackHandler.
  4. I haven't found anything wrong with the general/text/textColors portion of my options table? In fact, that part of it is working exactly as I intended. They're subgroups of the initial group, as per the groups documentation. The functions that get called return the group tables.
1. You provide an option for your users to turn on/off your AddOn. If you don't want that POWAH, let Ace3 call OnEnable() itself. And OnDisable() for that matter.
4. Hey, if it works, it works. I merely saw something that struck me as odd, and most of the time, odd = doesn't work. I've been wrong about stuff like this many, many times before.
  Reply With Quote
08-08-16, 09:21 AM   #14
MilleXIV
A Deviate Faerie Dragon
 
MilleXIV's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2016
Posts: 16
Will have to look into the globalstrings.lua for anything I need. Did not know about that.

Originally Posted by myrroddin View Post
1. You provide an option for your users to turn on/off your AddOn. If you don't want that POWAH, let Ace3 call OnEnable() itself. And OnDisable() for that matter.
4. Hey, if it works, it works. I merely saw something that struck me as odd, and most of the time, odd = doesn't work. I've been wrong about stuff like this many, many times before.
1. Ah. I'll keep that option in mind in case it's ever requested.
4. Yeah, the way I have it those groups show up as the content of my addon's node in the options looking similar to an HTML fieldset. I'd post a screenshot, but at work currently.

Also, just had a flash of memory. This is the commit after which things stopped working: https://github.com/MilleXIV/XIV_Data...214a286bc1840b. My only guess with this is the inclusion of AceEvent?
  Reply With Quote
08-08-16, 09:40 AM   #15
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Originally Posted by MilleXIV View Post
Also, just had a flash of memory. This is the commit after which things stopped working: https://github.com/MilleXIV/XIV_Data...214a286bc1840b. My only guess with this is the inclusion of AceEvent?
At a glance I don't see anything in there that would affect AceDB, but:

1. Forcing the Blizzard_TradeSkillUI to load isn't optimal. All the API functions to get data about your character's trade skills and recipes should be available and fully functional without loading the UI. If your addon is modifying the UI (I didn't actually check) then it would be better to delay that part of your addon until the UI is loaded naturally. Listen for ADDON_LOADED where arg1 is "Blizzard_TradeSkillUI".

2. While it doesn't affect functionality, organizing your code a little better will help you (and anyone else reading it) keep track of what's going on in the future. For example, here you're randomly mixing RegisterEvent and SetScript lines. It would be easier to tell, at a glance, what all is happening there if you put all the RegisterEvent lines together, and all the SetScript lines together.

3. What on earth is going on here? Rather than having one (named) function that just creates and returns another (anonymous) function that's always the same (eg. it doesn't change depending on what's passed to the wrapper function, or on any other variables or conditions), just name that inner function and refer to it, rather than wrapping it and calling the wrapper to get the reference. Actually, since it looks like you only call each wrapper once to get the inner function to set it as an OnClick hander, you should just use the inner function (anonymously) directly in the SetScript call:

Code:
self.frames.chat:SetScript('OnClick', function(self, button, down)
    if InCombatLockdown() then return; end
        if button == "LeftButton" then
            ChatFrame_OpenMenu()
        end
    end
end)
4. Similar to #2, you should avoid mixing tabs and spaces in your indentation, and if you use spaces (why) make sure you're using them consistently (eg. each level of indentation is always 4 spaces, not 4 here and 3 there and 5 over there). I only noticed #3 because it looked like you were missing an end statement, but on closer inspection, it turned out your indentation was just weird.

As for the original problem, do you have an error display installed? While the built-in error display has gotten a little better over the years, it's still sadly lacking in some essential features, like the ability to show you errors that happen during the initial loading process (which is where many of your errors will occur during development).
__________________
Author/maintainer of Grid, PhanxChat, oUF_Phanx, and many more.
Troubleshoot an addonTurn any code into an addonMore addon resources
Need help with your code? Post all of your actual code! Attach or paste your files.
Please don’t PM me about addon bugs or code questions. Post a comment or forum thread instead!
  Reply With Quote
08-08-16, 10:02 AM   #16
MilleXIV
A Deviate Faerie Dragon
 
MilleXIV's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2016
Posts: 16
1. My issue with that was that my calls to some Tradeskill functions were doing nothing after the addon was loaded. Though that might just be how it was called. I haven't even tested if that fixed it, so it might not even be necessary. Will probably work better once I change it over to using Modules (I'm adapting/rewriting somebody else's old code, working on Micromenu first).
2. Yeah, could probably separate those. I was organizing more by thing than by what I'm doing. Shouldn't be much of a difference.
3. There are a few bits that will be wrapping the default to add some functionality for the OnEnter, so that's why I did it for that one. For the others I was wrapping the OnClick handlers in another function due to disliking having too many anonymous functions in-line. Probably should move it to variables instead of a function call though.
4. That's what I get for working on two different computers that seem to have different settings. That's easily fixable later. Is there a community suggested standard or is it just personal preference? (i.e. I know the PHP community standard is 4 spaces).

I do have !BugGrabber and BugSack installed. I was getting no errors from my code, haven't checked since last night.

Last edited by MilleXIV : 08-08-16 at 10:10 AM.
  Reply With Quote
08-08-16, 11:45 AM   #17
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,727
ie, #4...

It's just personal preference, but be consistent. It will help you.

I prefer tabs, but if I *have* to use spaces (here on the forums or whatever) I prefer 5 to 4.
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
08-08-16, 12:12 PM   #18
MilleXIV
A Deviate Faerie Dragon
 
MilleXIV's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2016
Posts: 16
Originally Posted by Seerah View Post
ie, #4...

It's just personal preference, but be consistent. It will help you.

I prefer tabs, but if I *have* to use spaces (here on the forums or whatever) I prefer 5 to 4.
Oh I know it will. Just wasn't sure if there was a community suggested standard. The only reason this ended up getting mixed is that I had modified it on two different computers which seem to have had different settings, and I just didn't notice.
  Reply With Quote
08-08-16, 04:39 PM   #19
MilleXIV
A Deviate Faerie Dragon
 
MilleXIV's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2016
Posts: 16
So I've been running at this thing with the following script in WoWLua:

Lua Code:
  1. print('--------------------------------------------------')
  2. local xb = LibStub('AceAddon-3.0'):GetAddon('XIV_Databar')
  3. --local mmm = xb:GetModule('MenuModule')
  4.  
  5. function printTable(table, prefix)
  6.    for k,v in pairs(table) do
  7.       if type(v) == 'table' then
  8.          printTable(v, prefix..'.'..k)
  9.       else
  10.          print(prefix..'.'..k..': '..tostring(v))
  11.       end
  12.    end
  13. end
  14. printTable(xb.db, 'db')

Then stripped my addon down to as basic as I could. My OnInit only does AceDB:New, LSM:Register, self.frames = {}, sets up an options table (statically), then registers the options frame, and a slash command. My OnEnable has been set to just return.

If I run that after loading into the game it's completely missing self.db.profile. After I load up my config it fills in self.db.profile with my defaults.

The full OnInit/OnEnable/ToggleConfig:

Lua Code:
  1. function XIVBar:OnInitialize()
  2.   self.db = LibStub("AceDB-3.0"):New("XIVBarDB", self.defaults)
  3.   self.LSM:Register(self.LSM.MediaType.FONT, 'Homizio Bold', self.constants.mediaPath.."homizio_bold.ttf")
  4.   self.frames = {}
  5.  
  6.   local options = {
  7.     name = "XIV Bar",
  8.     handler = XIVBar,
  9.     type = 'group',
  10.     args = {
  11.       general = {
  12.         name = L['General'],
  13.         type = "group",
  14.         order = 3,
  15.         inline = true,
  16.         args = {
  17.           barPosition = {
  18.             name = L['Bar Position'],
  19.             type = "select",
  20.             order = 1,
  21.             values = {TOP = L['Top'], BOTTOM = L['Bottom']},
  22.             style = "dropdown",
  23.             get = function() return self.db.profile.general.barPosition; end,
  24.             set = function(info, value) self.db.profile.general.barPosition = value; self:Refresh(); end,
  25.           },
  26.           barColor = {
  27.             name = L['Bar Color'],
  28.             type = "color",
  29.             order = 2,
  30.             hasAlpha = true,
  31.             set = function(info, r, g, b, a)
  32.               XIVBar:SetColor('barColor', r, g, b, a)
  33.             end,
  34.             get = function() return XIVBar:GetColor('barColor') end
  35.           },
  36.         }
  37.       }
  38.     }
  39.   }
  40.  
  41.   options.args.profiles = LibStub("AceDBOptions-3.0"):GetOptionsTable(self.db)
  42.   options.args.profiles.order = 90
  43.  
  44.   LibStub("AceConfig-3.0"):RegisterOptionsTable(AddOnName, options)
  45.   self.optionsFrame = LibStub("AceConfigDialog-3.0"):AddToBlizOptions(AddOnName, "XIV Bar")
  46.  
  47.   self:RegisterChatCommand('xivbar', 'ToggleConfig')
  48. end
  49.  
  50. function XIVBar:OnEnable() return; end
  51.  
  52. function XIVBar:ToggleConfig()
  53.   InterfaceOptionsFrame_OpenToCategory(self.optionsFrame)
  54. end
  Reply With Quote
08-08-16, 04:58 PM   #20
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Try stripping it down even more. Does this work?

Lua Code:
  1. local XIVBar = LibStub("AceAddon-3.0"):NewAddon("XIVBar")
  2.  
  3. XIVBar.defaults = {
  4.   profile = {
  5.     general = {
  6.       barPosition = "BOTTOM",
  7.     }
  8.   }
  9. }
  10.  
  11. function XIVBar:OnInitialize()
  12.   self.db = LibStub("AceDB-3.0"):New("XIVBarDB", self.defaults)
  13.   print("XIVBar:OnInitialize", self.db.profile.general.barPosition)
  14. end

Also, if you're going to do this:

lua Code:
  1. P = self.db.profile

... you also need to register for the callbacks AceDB fires when the profile is switched or reset, and update your "P" upvalue when those things happen. Otherwise, you'll still be referring to the old profile even though the user has chosen a different one.

Finally, this makes my brain hurt:

lua Code:
  1. local AddOnName, Engine = ...
  2. local XIVBar = LibStub("AceAddon-3.0"):NewAddon(AddOnName, "AceConsole-3.0", "AceEvent-3.0")
  3.  
  4. local L = LibStub("AceLocale-3.0"):GetLocale(AddOnName, false)
  5.  
  6. local P = {}
  7. Engine[1] = XIVBar
  8. Engine[2] = L
  9. Engine[3] = P
  10. _G.XIVBar = Engine
  11.  
  12. _G[AddOnName] = Engine

This pattern is awful. If you want XIVBar, L, and P to be accessible in all files, just do this:

lua Code:
  1. local AddonName, XIVBar = ...
  2. LibStub("AceAddon-3.0"):NewAddon(XIVBar, AddonName, "AceConsole-3.0", "AceEvent-3.0")
  3. -- ^ now your addon's shared table is an AceAddon object
  4.  
  5. local L = LibStub("AceLocale-3.0"):GetLocale(AddOnName)
  6. XIVBar.L = L

Generally speaking you don't need to explicitly create a global for your AceAddon addons. If you want to look it up in another file, or if another addon wants to access it, they can do LibStub("AceAddon-3.0"):GetAddon("XIVBar").

"P" shouldn't even be given a default value if you're just going to use it as a pointer to the current profile, and it definitely shouldn't be stored on the shared addon object where (presumably) you're going to assign "local P = Engine[3]" or whatever in other files, because (as noted above) you need to update that pointer if the user picked another profile.

Really, you should just not bother with a file-level upvalue for "self.db.profile". If you're calling it so many times in a given function that it's tedious to type/read, or in a function where speed is of the essence (eg. CLEU or OnUpdate), just use an upvalue local to the function:

lua Code:
  1. function XIVBar:DoLotsOfStuffWithSettings()
  2.     local profile = self.db.profile
  3.     -- use profile in here
  4. end

That saves you the trouble of registering for profile callbacks and updating higher-level upvalues.
__________________
Author/maintainer of Grid, PhanxChat, oUF_Phanx, and many more.
Troubleshoot an addonTurn any code into an addonMore addon resources
Need help with your code? Post all of your actual code! Attach or paste your files.
Please don’t PM me about addon bugs or code questions. Post a comment or forum thread instead!
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » AceDB Resetting

Thread Tools
Display Modes

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