All variables that you want to save must be named in you .TOC file under the
SavedVariables section
Toc file info:
http://www.wowwiki.com/TOC_format
Blizzard saves the settings in a lua file with you addon name in the WTF folder.
..
## SavedVariables: MyVarA, MyVarB
## SavedVariablesPerCharacter: somePercharVariable
|
Blizzard will load and replace the variable with the saved settings.
There is a few events to tell you when this has happened. It will be done loading when ADDON_LOADED has fired.
I suggest using a table and save settings inside the table like keys. That way you minimize what you need to change when you add more settings or even remove them.
maybe something like this. just a suggestion, but its not needed.
Lua Code:
MyAddonSettings = {};
MyAddonSettings["Debug"] = true;
MyAddonSettings["Setting1"] = false;
MyAddonSettings["Playername"] = "Bob";
there are also some libraries (ace?) to do this for you.