Navigation menu
Personal tools
Not logged in
Talk
Contributions
Create account
Log in
Namespaces
WoW
Talk
English
Views
Read
Edit
History
More
Search
Navigation
Home
Random page
Help using wiki
Editions
for WoW
for WildStar
for Solar2D
Documentation
for WoW
for WildStar
Reference
WoW
⦁ FrameXML
⦁ AddOns
⦁ API
⦁ WoW Lua
WildStar
⦁ AddOns
⦁ API
⦁ WildStar Lua
Engine
Tools
What links here
Related changes
Special pages
Page information
Site
Recent Changes
Editing
WoW:Creating defaults
(section)
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=== Back to the Loaded Code! === In our function ThisAddon_Loaded() code, at the very end of it, let's add the following code: if (ThisAddon_Options["version"] < ThisAddon_Version) then ThisAddon_Options_temp = ThisAddon_Defaults["Options"]; for k,v in ThisAddon_Options do if (ThisAddon_Defaults["Options"][k]) then ThisAddon_Options_temp[k] = v; end end ThisAddon_Options_temp["version"] = ThisAddon_Version; ThisAddon_Options = ThisAddon_Options_temp; end * If the options version we loaded is lower that the version this code is running... (So if I change ThisAddon_Version to "1.2", and the user used "1.0" before this, this code will activate!) ** This creates a temp version of our options, based on the new defaults. All of the user's current settings have not been touched. ** This says, for all the options we loaded at the start... (The user's current settings...) *** If the same option is in the default options... **** Then copy that setting to the temporary options. *** End what to do if the same options exist ** End going through all of the default options. ** Update the temp option's version number to the latest version. ** Finally, copy the temp options, into the options in memory. * End this action.
Summary:
Please note that all contributions to AddOn Studio are considered to be released under the Creative Commons Attribution-NonCommercial-ShareAlike (see
AddOn Studio Wiki:Copyrights
for details).
Submissions must be written by you, or copied from a public domain or similar free resource (see
AddOn Studio Wiki:Copyrights
for details).
Cancel
Editing help
(opens in new window)