Quantcast Get addons list - WoWInterface
Thread Tools Display Modes
01-29-16, 05:30 AM   #1
Oniya
A Wyrmkin Dreamwalker
Join Date: Feb 2015
Posts: 57
Question 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?
  Reply With Quote
01-29-16, 06:10 AM   #2
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,289
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
  Reply With Quote
02-07-16, 10:12 AM   #3
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
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.
__________________
Author/maintainer of Grid, PhanxChat, oUF_Phanx, and many more.
Troubleshoot an addonTurn any code into an addonMore addon resources
Need help with your code? Post all of your actual code! Attach or paste your files.
Please don’t PM me about addon bugs or code questions. Post a comment or forum thread instead!
  Reply With Quote
02-08-16, 03:45 AM   #4
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,289
Originally Posted by Phanx View Post
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?
  Reply With Quote
02-10-16, 11:11 AM   #5
Vlad
A Molten Giant
 
Vlad's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2005
Posts: 792
Originally Posted by Resike View Post
Originally Posted by Phanx View Post
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.
__________________
Profile: Curse | Wowhead
  Reply With Quote
02-10-16, 07:36 PM   #6
Oniya
A Wyrmkin Dreamwalker
Join Date: Feb 2015
Posts: 57
Thanks a LOT mates!
  Reply With Quote

WoWInterface » Developer Discussions » General Authoring Discussion » Get addons list

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off