WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   How to read "Interface" TOC field? (https://www.wowinterface.com/forums/showthread.php?t=58226)

Zax 09-26-20 02:00 PM

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.

Tim 09-26-20 02:54 PM

That's because it's not a valid field.
https://wow.gamepedia.com/API_GetAddOnMetadata

Zax 09-27-20 01:13 AM

OK, so is there another way to get this value?

Rilgamon 09-27-20 06:12 AM

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

Seerah 09-27-20 12:18 PM

What exactly are you wanting to do with the info? Perhaps there is a different solution.

Zax 09-27-20 01:07 PM

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.


All times are GMT -6. The time now is 09:00 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI