View Single Post
05/08/17, 09:42 AM   #5
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,989
Simply specifying "self" is not returning the icon.
You need to let it return the SavedVariables data where the selected icon from the iconpicker is stored.

e.g.

function AuraMastery.EditAuraIcon(value)
AuraMastery.svars.auraData[activeAura].iconPath = value
end

getFunc = function() return AuraMastery.svars.auraData[activeAura].iconPath end,
setFunc = function(value) AuraMastery.EditAuraIcon(value) end,

basically needed the icon to dynamically change to the path returned by a function that is called on clicking another button that selects the aura to be currently edited. This active aura's path is stored in AuraMastery.svars.auraData[activeAura].iconPath.
default = AuraMastery.svars.DEFAULTS.auraData[activeAura].iconPath

The default values just need to be an array/table with all your possible saved variables as default values, which you use at the SavedVariables creation as the default values/fallback values if the real saved variables are missing (new savedvars version, new addon, settings = nil ...)
Setting the default values at lam controls will let you use the "Set back to defaults" button fo all the LAM controls e.g.

The getfunc will try to read the savedvars and if nothing is found (= nil) it will use the default value.
If the default value is the same that you use for the SavedVars creation the settings probably won't be nil, as they got copied from the defaults. So the getfunc will just automatically use the default variable which is stored in the savedvars now.

Last edited by Baertram : 05/08/17 at 09:48 AM.
  Reply With Quote