WoW:Saving variables between game sessions: Difference between revisions

m
m (First stab at this one)
 
Line 9: Line 9:
=== SavedVariables in AddOn's .toc ===
=== SavedVariables in AddOn's .toc ===


The best way is to use the SavedVariables keyword in your Addon's .toc file. If you have to store lots of pieces data, or data with dynamic keys, wrap it in one or two table variables rather than consuming huge quantities of global namespace.
The best way is to use the SavedVariables keyword in your Addon's .toc file. Thus, an addon with some saved variables would have a .toc like:
 
## Interface: 4114
## Title: Demo AddOn
## Notes: This is a test to show how to save variables between game sessions
## SavedVariables: Demo_test, Demo_foo
Demo.xml
 
If you have to store lots of pieces data, or data with dynamic keys, wrap it in one or two table variables rather than consuming huge quantities of global namespace.


This method is best because it works even if your module is not active (based on the ui addons menu), has a version mismatch, or fails during startup due to compilation, dependency, or other issues.
This method is best because it works even if your module is not active (based on the ui addons menu), has a version mismatch, or fails during startup due to compilation, dependency, or other issues.
Anonymous user