View Single Post
09-04-20, 10:03 AM   #12
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,877
You're creating myOptionsTable when your .lua file is loaded which is before the system has loaded your saved variables:
  • game reads your .lua file does what it needs at that stage (in this case including creating your table)
  • game then loads your saved variables.
Given you're initialising AceConfig :RegisterOptionsTable in the kickoff function called by AMine:OnEnable() (which Ace handles in an event), you could move the table above the kickoff () function and wrap it in a function of it's own (if you want to keep the separation) and call that during registration, ending up with something like:

Lua Code:
  1. local function initConfigSettings()
  2.       local myOptionsTable = {
  3.             ...
  4.       }
  5.       return myOptionsTable
  6. end
  7.  
  8. function kickoff()
  9.     AMine.db = LibStub("AceDB-3.0"):New("AMineDB", defaults)    
  10.     AMine.profileOptions = LibStub("AceDBOptions-3.0"):GetOptionsTable(AMine.db);
  11.     LibStub("AceConfig-3.0"):RegisterOptionsTable("Profiles", AMine.profileOptions);
  12.     local options = initConfigSettings()
  13.     LibStub("AceConfig-3.0"):RegisterOptionsTable(THISAP, options);
  14.     AMine.myOptions = LibStub("AceDBOptions-3.0"):GetOptionsTable(options);
  15.     AMine.myOptions = LibStub("AceConfigDialog-3.0"):AddToBlizOptions(THISAP, nil, nil)  
  16.     AMine.myOptions.buh = LibStub("AceConfigDialog-3.0"):AddToBlizOptions(THISAP, "buh", THISAP, "spellsels");
  17.     AMine.profilesFrame = LibStub("AceConfigDialog-3.0"):AddToBlizOptions("Profiles", "Profiles", THISAP);
  18. end

or you could create the table inside the kickoff function before registering it.
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

Last edited by Fizzlemizz : 09-04-20 at 10:50 AM.
  Reply With Quote