Thread: API Changes
View Single Post
09-05-14, 07:26 AM   #26
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Originally Posted by Rainrider View Post
I also don't find GetAddOnEnableState particularly useful. You could get this info from GetAddOnInfo's fifth return (named "reason" in previous posts in this thread). If reason is not "DISABLED" then the addon is enabled.
GetAddOnEnableState is theoretically useful; while GetAddOnInfo only tells you whether the addon is enabled on the currect character, with GetAddOnEnableState you can get a bit more detail:

Addon is enabled on all characters:
GetAddOnEnableState(nil, index) => 2
GetAddOnEnableState("Charname", index) => 2

Addon is only enabled on some characters, including the current one:
GetAddOnEnableState(nil, index) => 1
GetAddOnEnableState("Charname", index) => 2

Addon is only enabled on some characters, but not on the current one:
GetAddOnEnableState(nil, index) => 1
GetAddOnEnableState("Charname", index) => 0

Addon is not enabled on any characters:
GetAddOnEnableState(nil, index) => 0
GetAddOnEnableState("Charname", index) => 0

The only real use I can think of for this information is in addon managers; the new in-game Blizzard addon manager is the same one that you can use at the character screen, including the "all/character" dropdown, though you can only choose "All" or the current character when using it in-game.

Originally Posted by Rainrider View Post
Apart from that the old behavior of GetAddOnInfo is easily achieved by creating an addon_name = addon_index dictionary, isn't it?
Yeah, but that's still annoying, and requires a significant increase in code clutter and complexity for no apparent reason. LoadAddOn can still handle names, so it's not like they just decided to remove the ability to identify addons by name on the C side. They just disabled the functionality for certain API functions because ... well, because.

If all they wanted was to stop people from being able to disable the Blizzard_* addons, they should have just done that instead of breaking the whole API.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.