Thread Tools Display Modes
09/06/21, 09:48 PM   #1
Shadowfen
AddOn Author - Click to view addons
Join Date: Jun 2016
Posts: 83
[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.
 
10/16/21, 03:34 AM   #2
sirinsidiator
 
sirinsidiator's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 1,566
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?
 
10/16/21, 07:47 PM   #3
Shadowfen
AddOn Author - Click to view addons
Join Date: Jun 2016
Posts: 83
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.
 
10/16/21, 08:51 PM   #4
Calamath
AddOn Author - Click to view addons
Join Date: Aug 2019
Posts: 36
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.
 
10/17/21, 12:45 AM   #5
Shadowfen
AddOn Author - Click to view addons
Join Date: Jun 2016
Posts: 83
Originally Posted by Calamath View Post
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.
 
10/17/21, 01:59 AM   #6
Scootworks
 
Scootworks's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2014
Posts: 312
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())
 
10/17/21, 05:36 AM   #7
sirinsidiator
 
sirinsidiator's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 1,566
Originally Posted by Shadowfen View Post
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.
 

ESOUI » Developer Discussions » Bug Reports » [notabug] GetAddOnVersion only works with libraries

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