|This function is PROTECTED, and can only be called from Blizzard code.
This function is deprecated, use the .toc-file. Put in a line like
## SavedVariables: name1, name2, ...
## SavedVariablesPerCharacter: name1, name2, ...
Old documentation[edit | edit source]
Registers the named variable to be saved when the client shuts down (or the UI is reloaded) in the SavedVariables.lua file, so that its value will be loaded when the UI engine is restarted. IMPORTANT: Use of this has been largely deprecated in favor of the SavedVariables: tag in the AddOn's .toc file, see the details section below for reasons why. (Both mechanisms can be used, either of them simply flag the variable for saving).
- String - The name of the variable to save.
- The new SavedVariables mechanism in the AddOn's .toc file is preferred to using this function because it will work even if the AddOn has been temporarily deactivated, or if it fails to load.
- Using RegisterForSave instead is problematic if deactivation or an error prevents the function from executing, because even though the variable will be loaded when the engine starts, it wont be registered afterwards and so when the engine shuts down again, the value will be lost.
- Don't use dynamically generated variable names, it's just a mess for other people to deal with. If you dont know which values you'll need ahead of time, make them all values within a single table variable.