WoWInterface - View Single Post - AceDB lost default values on SetProfile
View Single Post
09-17-17, 05:28 PM   #2
A Pyroguard Emberseer
myrroddin's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 1,124
AceDB only writes settings that have been altered to the SavedVariables file. It does not write if nothing has been changed.

In your example, defaultValue has a default of true; you did not change it to false, "Ted", or 007, it is still true. Therefore it is nil in your SV file. Nothing is lost. In fact, it retains the default value from PROFILE_DEFAULTS in memory.

BTW, here's a tip: change this line. This will create a literal profile called Default in the Profiles options tree when presented to the user. You will see what I mean when you load into the game. It makes the life of the user a lot easier.
self.db = LibStub("AceDB-3.0"):New("MyAddonDB", PROFILE_DEFAULTS, true) -- add true to the end
Also, using SetProfile() as I understand it (could be wrong, but based on your question...) only sets the profile name, it does not set the values of the profile being set. For that, you want CopyProfile(). In any case, if you want people to have one set of values universally upon login, see the code line above.


Last edited by myrroddin : 09-17-17 at 05:30 PM. Reason: grammar
  Reply With Quote