Thread Tools Display Modes
05-27-23, 07:54 PM   #1
MinguasBeef
A Wyrmkin Dreamwalker
AddOn Author - Click to view addons
Join Date: May 2019
Posts: 51
How to identify the SavedVariables / SavedVariablesPerCharacter vars?

So, in my addon toc let's say I have the following...

## SavedVariables: MAV
## SavedVariablesPerCharacter: MCV

I know that the account wide variables will be stored in MAV and the character variables will be stored in MCV.

Is there any way I can retrieve these variables with a function on a per addon basis?
Ex. If I did GetSavedVariables("MyAddonName") I would want to get MAV back or if I did GetSavedVariablesPerCharacter("MyAddonName") I would want to get MCV back. Is there any built in function in the WoWAPI like this?

Ex.
GetSavedVariables("Dominos") might return the DominosDB variable since Dominos.tos is set up such as
## SavedVariables: DominosDB
  Reply With Quote
05-27-23, 07:58 PM   #2
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,871
Both MAV and MCV will be created as global variables and therefore available to all addons.

It's one of the reasons you need to make sure your Saved Variables names are unique (maybe prefixed with the addon name or something similar).
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.
  Reply With Quote
05-27-23, 08:04 PM   #3
MinguasBeef
A Wyrmkin Dreamwalker
AddOn Author - Click to view addons
Join Date: May 2019
Posts: 51
Originally Posted by Fizzlemizz View Post
Both MAV and MCV will be created as global variables and therefore available to all addons.

It's one of the reasons you need to make sure your Saved Variables names are unique (maybe prefixed with the addon name or something similar).
I know this, but this wasn't my question. I am trying to figure out how to pull the variables based off the addon name. Or how to pull all of the variables being used for saved variables in general.
  Reply With Quote
05-27-23, 08:07 PM   #4
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,871
No real way to know (without a list) if a global is a "SavedVariable" global or a Blizzard global or a oops I forgot to add local global...
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.
  Reply With Quote
05-27-23, 08:08 PM   #5
MinguasBeef
A Wyrmkin Dreamwalker
AddOn Author - Click to view addons
Join Date: May 2019
Posts: 51
Originally Posted by Fizzlemizz View Post
No real way to know (without a list) if a global is a "SavedVariable" global or a Blizzard global or a oops I forgot to add local global...
Makes sense. This is what I was assuming.

Thanks very much for taking the time to answer!
  Reply With Quote
05-27-23, 08:12 PM   #6
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,871
Unless it's one of the fields usable from GetAddOnMetadata but the SavedVariable fields aren't listed so I doubt it.
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.
  Reply With Quote
05-27-23, 11:20 PM   #7
MinguasBeef
A Wyrmkin Dreamwalker
AddOn Author - Click to view addons
Join Date: May 2019
Posts: 51
Originally Posted by Fizzlemizz View Post
Unless it's one of the fields usable from GetAddOnMetadata but the SavedVariable fields aren't listed so I doubt it.
I checked with GetAddOnMetadata and it looks like you're right it doesn't work for the SavedVariable fields.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » How to identify the SavedVariables / SavedVariablesPerCharacter vars?

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off