ESOUI

ESOUI (https://www.esoui.com/forums/index.php)
-   Bug Reports (https://www.esoui.com/forums/forumdisplay.php?f=187)
-   -   [notabug] GetAddOnVersion only works with libraries (https://www.esoui.com/forums/showthread.php?t=9908)

Shadowfen 09/06/21 09:48 PM

[notabug] GetAddOnVersion only works with libraries
 
When an addon declares that it is a library
Code:

## IsLibrary: true
then the value reported for
Code:

AddOnVersion:
in the manifest file is returned by GetAddOnVersion().
If IsLibrary is set to false, then GetAddOnVersion() always returns 0 even when an AddOnVersion is provided.

sirinsidiator 10/16/21 03:34 AM

Are you sure that's true? I just checked a debug log someone sent me and it actually has the addon version for all addons that specify it. I even checked some older files and it has always shown the version as it should.

You are aware that AddOnVersion has to be an unsigned integer, right?

Shadowfen 10/16/21 07:47 PM

Yes, I am aware that addon version is an unsigned integer. I tested it on one of my addons that had
Code:

## Version: 1.26
## AddOnVersion: 46

that is not a library and GetAddOnVersion() always returns 0 in my test.

Calamath 10/16/21 08:51 PM

In the recent process of testing my add-on 'Calamath's Addon Diagnosis', I share the same view as siri.

I would recommend that you also pass the argument you passed to GetAddOnVersion() to GetAddOnInfo() to check the add-on name once again and make sure that the index at runtime matches the add-on you expect.

Shadowfen 10/17/21 12:45 AM

Quote:

Originally Posted by Calamath (Post 44839)
In the recent process of testing my add-on 'Calamath's Addon Diagnosis', I share the same view as siri.

I would recommend that you also pass the argument you passed to GetAddOnVersion() to GetAddOnInfo() to check the add-on name once again and make sure that the index at runtime matches the add-on you expect.

I did back when I reported it. However several patches have come out since then and it is possible that it was fixed and forgotten when the changes were published since I'm relatively sure that it would be a minor fix.

Scootworks 10/17/21 01:59 AM

did you try something like this?

Lua Code:
  1. local ADDON_NAME = "YourAddon"
  2.  
  3. local function GetAddOnVersion()
  4.     local addOnManager = GetAddOnManager()
  5.     for i = 1, addOnManager:GetNumAddOns() do
  6.         local name = addOnManager:GetAddOnInfo(i)
  7.         if name == ADDON_NAME then
  8.             return addOnManager:GetAddOnVersion(i)
  9.         else
  10.             d("addOnName has not been found")
  11.         end
  12.     end
  13.     return 0
  14. end
  15.  
  16. d(GetAddOnVersion())

sirinsidiator 10/17/21 05:36 AM

Quote:

Originally Posted by Shadowfen (Post 44842)
I did back when I reported it. However several patches have come out since then and it is possible that it was fixed and forgotten when the changes were published since I'm relatively sure that it would be a minor fix.




Not sure what you did wrong during your tests, but it was always working. ;)


All times are GMT -6. The time now is 11:27 PM.

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