Quantcast
How to read "Interface" TOC field? - WoWInterface
Thread Tools Display Modes
09-26-20, 02:00 PM   #1
Zax
A Cliff Giant
AddOn Author - Click to view addons
Join Date: Aug 2006
Posts: 75
How to read "Interface" TOC field?

Hello,

Is there a way to read "Interface" field in the TOC file of an addon?
I tried:
Code:
GetAddOnMetadata(myAddonName, "Interface")
but only "nil" is returned.

Thanks.
  Reply With Quote
09-26-20, 02:54 PM   #2
Tim
A Frostmaul Preserver
 
Tim's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2008
Posts: 285
That's because it's not a valid field.
https://wow.gamepedia.com/API_GetAddOnMetadata
__________________
AddOns: Tim @ WoWInterface
Characters: Hunter, Mage, Priest, Monk, DH,
Battle Tag: Tim#11172
Current PC Setup: PCPartPicker List
  Reply With Quote
09-27-20, 01:13 AM   #3
Zax
A Cliff Giant
AddOn Author - Click to view addons
Join Date: Aug 2006
Posts: 75
OK, so is there another way to get this value?
  Reply With Quote
09-27-20, 06:12 AM   #4
Rilgamon
Premium Member
 
Rilgamon's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Sep 2009
Posts: 790
You might take a look at https://www.townlong-yak.com/framexm...onList.lua#478

Lua Code:
  1. function AddonList_HasOutOfDate()
  2.     local hasOutOfDate = false;
  3.     for i=1, GetNumAddOns() do
  4.         local name, title, notes, loadable, reason = GetAddOnInfo(i);
  5.         local character = nil;
  6.         if (not InGlue()) then
  7.             character = UnitName("player");
  8.         end
  9.         local enabled = (GetAddOnEnableState(character, i) > 0);
  10.         if ( enabled and not loadable and reason == "INTERFACE_VERSION" ) then
  11.             hasOutOfDate = true;
  12.             break;
  13.         end
  14.     end
  15.     return hasOutOfDate;
  16. end
__________________
The cataclysm broke the world ... and the pandas could not fix it!
  Reply With Quote
09-27-20, 12:18 PM   #5
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,767
What exactly are you wanting to do with the info? Perhaps there is a different solution.
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
09-27-20, 01:07 PM   #6
Zax
A Cliff Giant
AddOn Author - Click to view addons
Join Date: Aug 2006
Posts: 75
Thank you Rilgamon. I tried your script but "reason" is NIL when the addon TOC interface is 9.x on WoW Retail (8.x).
I wanted to compare an addon TOC interface number with WoW version number but I realised I don't need to perform such a test. Sorry to ask a stupid question, and thank you for your replies.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » How to read "Interface" TOC field?

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