Creating defaults This is a basic HOWTO to help you create defaults for your addon . First , I ' m going to assume you are at least familiar with how to start an addon , and make it save variables . If not , please check out this page on how to start an addon and Saving variables between game sessions . This is required knowledge for our defaults . The Basics . Let ' s begin . At the top of the page , before any functions , add this : Now for an explanation . . . There we go . This is a quick and easy way to set up defaults . The Next Step . Now let ' s add a bit more complexity . I mean , we have the list of defaults . . . Now what can we do with them ? Initialization . Let ' s make it so when the addon starts , if the settings aren ' t there , the defaults will be set ! So , for this , let ' s assume we have a options variable being saved , by the name of " ThisAddon _ Options " . All of our options settings are saved to that , and this is saved from session to session . So let ' s save our options ! The XML . First off , we need to make a function that we call when our addon has finished loading . . . To do that , first we need to add a line to the OnLoad section of our XML file . This gives our addon something to look for to see if it has finished loading . If our addon was a LoadOnDemand type of addon ( not loaded until it is needed ) , we would want to use " ADDON _ LOADED " . Also , while we ' re here , let ' s add a bit of code we ' ll need later . After < / OnLoad > , add the following : This will tell our addon to run the ThisAddon _ Loaded ( ) function as soon as the addon has been fully loaded . Okay ! We ' re done here ! Let ' s jump back to our main code ! The Main Code . Now we can write our post - load function . . . This will run after the addon has been fully loaded . We do it this way , because if we call things that haven ' t been loaded yet , then our addon will fail , and output an error message . This way , everything will have already been loaded . See ? We ' re done . Fairly simple . And if we end up changing our defaults , then we don ' t have to type them in again . The Future . . . . The Possibilities . There ' s even more we can do with Defaults . You ' ll noticed that I added [ " version " ] to the list of defaults at the top . There is an excellent reason for this . Let ' s say that I did some more work , and created a new version of the addon , Version 1 . 2 , and I changed , removed , and added a lot of options to the defaults . Rather than tell people to delete the existing settings they have , let ' s write a code that will automatically update their options upon finding the version difference ! But first , let ' s add a global at the top of the page : This will make it easy for us to check and update the internal version number . In fact , in the Defaults , we can set which will make it even easier to check and change versions . Back to the Loaded Code ! In our function ThisAddon _ Loaded ( ) code , at the very end of it , let ' s add the following code : Advanced Default Setting Updating . Having worked with this for so long now , I ' ve developed even more advanced methods for using these defaults . The first thing I ' ve done is seperated the update code from the loading code , so it is it ' s own function . Another change I ' ve made is that it can now work with tables within tables . The following can work with up to 3 levels of tables within your defaults . ( Main level , 1 subtable , and a subtable within that . ) You will also notice that if the version you are upgrading from is below or equal to version 1 . 2 , then an error message will be displayed using a custom message display function . ( Which I won ' t get into here . ) This is useful if you ' ve made major database changes and don ' t feel like making an adaptor for the settings . A common use of this would be if you had a lot of settings , but decided to move them into a subtable . This would ensure the old settings were erased . This functionality should be used sparingly . Now let ' s go through this ; That ' s the basics of this new setting . The best thing is , now in our Post - Load function , instead of writing all that out , we just call : Now you can do even more with defaults ! If you come up with something new and original , put it on this HowTo ' s Discussion page ! I ' d love to see how people use this !