Ok... I get the theory, but I realise I still mis something.
My problem is that the keys are dynamic. I'm trying to do the following. My addon saves skill data per character. I want to be able to remove that data for a specific character, chosen from a list.
So.
TopLevelKey is the dataitem that keeps track of the skills.
SubLevelKey is a charactername ("realmName|toonName")
Currently I create a little pop out menu listing all characters (other than the current) in the same realm. Each dewdrop entry call a function
Code:
'func', function() self:PurgeCharacterData(realmName..'|'..toonName) end
This function should do the purging. I've rewritten it similar to what you suggest but I got a feeling this won't work.
Code:
function SkillsPlusFu:PurgeCharacterData(toonSaveKey)
self.db.profile.toonSave.toonSaveKey = nil
self.db.profile.skillSave.toonSaveKey = nil
self:Update()
end
I guess the error messages (invalida array index) on the second line and a zero effect on the savedvariable file even if I comment out that line are dead giveaways as to it not working.