WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   How to identify the SavedVariables / SavedVariablesPerCharacter vars? (https://www.wowinterface.com/forums/showthread.php?t=59594)

MinguasBeef 05-27-23 07:54 PM

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

Fizzlemizz 05-27-23 07:58 PM

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

MinguasBeef 05-27-23 08:04 PM

Quote:

Originally Posted by Fizzlemizz (Post 342481)
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.

Fizzlemizz 05-27-23 08:07 PM

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

MinguasBeef 05-27-23 08:08 PM

Quote:

Originally Posted by Fizzlemizz (Post 342483)
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!

Fizzlemizz 05-27-23 08:12 PM

Unless it's one of the fields usable from GetAddOnMetadata but the SavedVariable fields aren't listed so I doubt it.

MinguasBeef 05-27-23 11:20 PM

Quote:

Originally Posted by Fizzlemizz (Post 342485)
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.


All times are GMT -6. The time now is 08:14 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI