WoW:Creating defaults: Difference between revisions

m
Line 14: Line 14:
  };
  };


Now for an explination...
Now for an explanation...


* local ThisAddon_Defaults - This one is easy enough. First, we declare that our defaults are local to this LUA file only. If you choose not to use local, then any addon can use your defaults. Removing the "local" may be needed if you expand your addon's need for defaults beyond a single file. Second, we give the library of defaults a name. In this case, I choose to use the Addon's Name, then _Defaults. This naming convention is a good idea even if you keep the "local".  
* local ThisAddon_Defaults - This one is easy enough. First, we declare that our defaults are local to this LUA file only. If you choose not to use local, then any addon can use your defaults. Removing the "local" may be needed if you expand your addon's need for defaults beyond a single file. Second, we give the library of defaults a name. In this case, I choose to use the Addon's Name, then _Defaults. This naming convention is a good idea even if you keep the "local".  
** ["Options"] - The name of the table our Options defaults are in. I recommend this in case you need to add more defaults and don't want them intermingling. For example, a list of defaults for items should be seperate from your options.
** ["Options"] - The name of the table our Options defaults are in. I recommend this in case you need to add more defaults and don't want them intermingling. For example, a list of defaults for items should be separate from your options.
*** Your variables - These are how your variables should be set when installing a fresh copy of your addon.
*** Your variables - These are how your variables should be set when installing a fresh copy of your addon.
** End our list of option variables.
** End our list of option variables.
Anonymous user