Thread: Saved Variables
View Single Post
08-30-12, 01:27 PM   #3
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,327
Saved Variables are first defined in the TOC file. This tells WoW which globals to save for your addon when the user logs out.

TOC:
Code:
## SavedVariables: Global_Name
## SavedVariablesPerCharacter: Global_Name
It's pretty straightforward what each line does. The first is used to register the global Global_Name to be saved account-wide. The second does this just for the character you logged on. That's only half of it as you need to define the global in Lua too just like any other variable. The only difference is WoW saves the variable and fires PLAYER_LOGOUT when logging out or reloading UI. Saved data if any is available when ADDON_LOADED fires for your addon.
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)

Last edited by SDPhantom : 12-12-15 at 12:07 PM.
  Reply With Quote