WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   General Authoring Discussion (https://www.wowinterface.com/forums/forumdisplay.php?f=20)
-   -   Get addons list (https://www.wowinterface.com/forums/showthread.php?t=53101)

Oniya 01-29-16 05:30 AM

Get addons list
 
Is there a method to get addons list? The only i found is
Code:

numAddons = GetNumAddOns()
only getting count, but no for foreach looping them, think there should a way for it, maybe some one know it? :)

Resike 01-29-16 06:10 AM

Lua Code:
  1. for i = 1, GetNumAddOns() do
  2.     local name, title, notes, enabled, loadable, reason, security = GetAddOnInfo(i)
  3.     print(name, title, notes, enabled, loadable, reason, security)
  4. end

Phanx 02-07-16 10:12 AM

Those return values are incorrect. GetAddOnInfo's return values changed with the release of WoD, and the enabled return was moved to a different function:

Code:

local CHARACTER = UnitName("player")
for i = 1, GetNumAddOns() do
    local name, title, notes, loadable, reason, security, newVersion = GetAddOnInfo(i)
    local enabled = GetAddOnEnableState(CHARACTER, id)
    -- do stuff here
end

You can alternatively pass nil instead of a character name to GetAddOnEnableState to query whether the addon is enabled/disabled for all characters, instead of just for the specified one.

EnableAddOn(i) and DisableAddOn(i) can be called with true as a second argument to enable/disable the addon for all characters, instead of just for the current one.

Resike 02-08-16 03:45 AM

Quote:

Originally Posted by Phanx (Post 312921)
Those return values are incorrect. GetAddOnInfo's return values changed with the release of WoD, and the enabled return was moved to a different function:

Code:

local CHARACTER = UnitName("player")
for i = 1, GetNumAddOns() do
    local name, title, notes, loadable, reason, security, newVersion = GetAddOnInfo(i)
    local enabled = GetAddOnEnableState(CHARACTER, id)
    -- do stuff here
end

You can alternatively pass nil instead of a character name to GetAddOnEnableState to query whether the addon is enabled/disabled for all characters, instead of just for the specified one.

EnableAddOn(i) and DisableAddOn(i) can be called with true as a second argument to enable/disable the addon for all characters, instead of just for the current one.

I guess id should be i here?

Vlad 02-10-16 11:11 AM

Quote:

Originally Posted by Resike (Post 312935)
Quote:

Originally Posted by Phanx (Post 312921)
Those return values are incorrect. GetAddOnInfo's return values changed with the release of WoD, and the enabled return was moved to a different function:

Code:

local CHARACTER = UnitName("player")
for i = 1, GetNumAddOns() do
    local name, title, notes, loadable, reason, security, newVersion = GetAddOnInfo(i)
    local enabled = GetAddOnEnableState(CHARACTER, id)
    -- do stuff here
end

You can alternatively pass nil instead of a character name to GetAddOnEnableState to query whether the addon is enabled/disabled for all characters, instead of just for the specified one.

EnableAddOn(i) and DisableAddOn(i) can be called with true as a second argument to enable/disable the addon for all characters, instead of just for the current one.

I guess id should be i here?

That is correct.

Oniya 02-10-16 07:36 PM

Thanks a LOT mates! :)


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

vBulletin © 2020, Jelsoft Enterprises Ltd
© 2004 - 2020 MMOUI