API RegisterForSave

104,672pages on
this wiki
Add New Page
Talk0 Share
WoW API < RegisterForSave

This function is deprecated, use the .toc-file. Put in a line like

## SavedVariables: name1, name2, ...


## SavedVariablesPerCharacter: name1, name2, ...

Old documentation Edit


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.

Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.

Also on Fandom

Random Wiki