-
Posted by tekkguy on Thu, 03 Mar 2011 14:50:48
Quick question(s)...
1) Is there a function to retrieve the current Version Number of your AddOn?
2) How do you get your AddOn to determine if a newer version of itself exists? Is there a LUA module pre-written that gives AddOn's that functionality? Or is it a relatively simple set of commands?
-
Posted by jnwhiteh on Thu, 03 Mar 2011 15:39:54
Quick question(s)...
1) Is there a function to retrieve the current Version Number of your AddOn?
If it's listed in your TOC:
local version = GetAddOnMetadata("YourAddonName", "Version")
Otherwise you can't.
2) How do you get your AddOn to determine if a newer version of itself exists? Is there a LUA module pre-written that gives AddOn's that functionality? Or is it a relatively simple set of commands?
You don't. There is no communication outside of the game. The best you can do is check with members of your guild/party/raid using the addon communication API to see if any of them have a newer version. It's non-trivial and doesn't add all that much, actually.
-
Posted by Myrroddin on Sat, 05 Mar 2011 13:23:40
You might want to look how most library files do the checking.
local ADDON_VERSION = 90000 + tonumber(("$Revision: 74 $"):match("%d+"))
This assumes a few things, like you are using SVN, although if Git has keyword substitutions, then great. You would keyword Revision. Also, you don't need to add the 90000 but most people do because 11 and 111 and 1111 etc all match the same pattern, or something like that.
Then you use the addon chat channel to broadcast your version to guild/party/raid/whisper or wherever and listen back. Compare the incoming number with ADDON_VERSION to find out which is higher.
You can also use LibVersionCheck-1.0 if that makes it easier. The API is on the pages tab.
-
Posted by jnwhiteh on Sat, 05 Mar 2011 17:46:27
You might want to look how most library files do the checking.
local ADDON_VERSION = 90000 + tonumber(("$Revision: 74 $"):match("%d+"))
This assumes a few things, like you are using SVN, although if Git has keyword substitutions, then great. You would keyword Revision. Also, you don't need to add the 90000 but most people do because 11 and 111 and 1111 etc all match the same pattern, or something like that.
This is precisely why I didn't suggest this.. most of what is done in those addon libraries are terrible legacy hacks.. I can say that because I implemented a few of them myself. Also, Git does not have numeric revisions so this won't work, it'd only work with svn.
Then you use the addon chat channel to broadcast your version to guild/party/raid/whisper or wherever and listen back. Compare the incoming number with ADDON_VERSION to find out which is higher.
Better to write a reasonable comparison function based on your own version formats, in my opinion.
You can also use LibVersionCheck-1.0 if that makes it easier. The API is on the pages tab.
Interesting, thanks for the link. Personally, I think its not worth it for 99% of the cases =)