local mainName = GetMainName("SomeAlt")
local alts = { GetAltNames("SomeMain") }
Now you maintain your own SVs, and you can have multiple addons providing data, and the API is lolminimal.
An implementation would be something along the lines of:
local oldGetMainName = GetMainName or function() return end
function GetMainName(name)
if myAddon.db.chars[name] and myAddon.db.chars[name].main then
return myAddon.db.chars[name].main
else
return oldGetMainName(name)
end
end
Tadaa?
(Note "return" vs "return nil", which becomes important for alt names. "return nil" = 1 entry with nil in it. "return" = 0 values.)
Edit: Oh, and addons both providing and displaying main/alt data, e.g. Prat/Chatter, should of course call GetMainName() themselves, not only look in their own SVs.
My version uses less memory and doesn't require a library? :p
Edit: Oh, and moves the CPU load to on-demand bit-by-bit as-needed and not a full copy every time you load the UI.
I can probably think of more if I really try :D
local mainName = GetMainName("SomeAlt")
local alts = { GetAltNames("SomeMain") }
Now you maintain your own SVs, and you can have multiple addons providing data, and the API is lolminimal.
An implementation would be something along the lines of:
Tadaa?
(Note "return" vs "return nil", which becomes important for alt names. "return nil" = 1 entry with nil in it. "return" = 0 values.)
Edit: Oh, and addons both providing and displaying main/alt data, e.g. Prat/Chatter, should of course call GetMainName() themselves, not only look in their own SVs.