Maintenance for the week of December 30:
• PC/Mac: No maintenance – December 30

Figure out the API version from OnLoaded/Code

zgrssd
zgrssd
✭✭✭✭
My one addon is UTC. When they reset the data I realised that I should have reset the data anyway.
If the API version changed, there is a chance that the number or (more importantly) the order of things like the Chat cateogries might have changed.
To be on the save side I disabeled my Addon on code level (commented everything out) and am now looking into a way to get the API version in my code (to store it with the data and reset the data if it is missmatched).

The thing is I don't see any way to do that with the Documentation found on ESOUI.com
No obvious function or global variable containing the API version anywhere. Does anybody here know of a way?
Edited by zgrssd on June 25, 2014 1:54PM
Elana Peterson (EU), Dominion, Imperial Sorc, Rune & Alchemy Crafting Char
Leonida Peterson (EU), Daggerfall, Kajiit Nightblade, Tank & main Crafter
Kurga Peterson (EU), Ebonhart, Ork Dragonknight, Provision Mule
Coldblood Peterson (EU) Argonian Templer, Daggerfall, Healer
Incendia Peterson (EU), Dominion, Dunmer Dragonknight, fire DPS & healer
Haldor Belendor (EU), Ebonhart, Breton Sorcerer, Tank
Fuliminictus Peterson (EU), Ebonhart, Altmer Sorcerer, Electric DPS

Me babbling about PvE roles and Armor, Short Guide to Addon Programming (for Programmers)

If you think anything I or somebody else said violates the Rules of this Forum, you are free to flag my posts. Till I get any notifcaion from this, I just asume you know you have no case against me or Zenimax disagrees with you.
  • zgrssd
    zgrssd
    ✭✭✭✭
    Even after some digging through the Global Tables of the API we found nothing to directly find the API version. In any case I added it to the esoui.com wishlist.

    However, Shinni came up with this little code (re-posted here from non-ESOUI developers) that allwos to figure out if the addon is out of date:
    local AddOnManager = GetAddOnManager()
        for i = 1, AddOnManager:GetNumAddOns() do
                local name, title, author, description, enabled, state, isOutOfDate = AddOnManager:GetAddOnInfo(i)
            if title == "myaddonname" then
                if isOutOfDate then
                    --api change!
                end
            end
        end
    
    Not a perfect match, but it will do.
    I will propably write a small library to do that with buffering, so we avoid having to do the same work twice.
    Edited by zgrssd on June 27, 2014 4:03PM
    Elana Peterson (EU), Dominion, Imperial Sorc, Rune & Alchemy Crafting Char
    Leonida Peterson (EU), Daggerfall, Kajiit Nightblade, Tank & main Crafter
    Kurga Peterson (EU), Ebonhart, Ork Dragonknight, Provision Mule
    Coldblood Peterson (EU) Argonian Templer, Daggerfall, Healer
    Incendia Peterson (EU), Dominion, Dunmer Dragonknight, fire DPS & healer
    Haldor Belendor (EU), Ebonhart, Breton Sorcerer, Tank
    Fuliminictus Peterson (EU), Ebonhart, Altmer Sorcerer, Electric DPS

    Me babbling about PvE roles and Armor, Short Guide to Addon Programming (for Programmers)

    If you think anything I or somebody else said violates the Rules of this Forum, you are free to flag my posts. Till I get any notifcaion from this, I just asume you know you have no case against me or Zenimax disagrees with you.
Sign In or Register to comment.