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).

Arguments

("variable")

variable

String - The name of the variable to save.

Details

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.