Thread Tools Display Modes
10-06-10, 04:01 PM   #1
Grimsin
A Molten Giant
 
Grimsin's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 990
Making beta/live compat ver checker

So im trying to make a core function that would make it easy to have it check the build and version data then run functions accordingly. This is what i have so far but it does not work... i cant figure out why.

first this piece makes the function to do the comparing of later functions
Code:
local addonName, addon = ...

_G[addonName] = addon
--[[-----------------------------------------------------------------------------
Blizzard Build comparisonn for ptr/beta/live compatible versions
-------------------------------------------------------------------------------]]
function addon:CompareBuild(comver, combuild, comref, lowcomref, highcomref)
	local version, build, bdate, toc = GetBuildInfo()
	if version >= comver and build >= combuild then
		addon[highcomref]()
	elseif version <= comver and build <= combuild then
		addon[lowcomref]()
	elseif version == comver and build == combuild then
		addon[comref]()
	end
end
this piece actually uses it on the two functions i hav emade or at lest its supposed to it gives me an error.

Code:
function addon:MicroButtonsCatVer()
    local buttons = { CharacterMicroButton, SpellbookMicroButton, TalentMicroButton, AchievementMicroButton, QuestLogMicroButton, FriendsMicroButton, GuildMicroButton, PVPMicroButton, LFDMicroButton, MainMenuMicroButton, HelpMicroButton }
end

function addon:MicroButtonsPreCatVer()
    local buttons = { CharacterMicroButton, SpellbookMicroButton, TalentMicroButton, AchievementMicroButton, QuestLogMicroButton, FriendsMicroButton, PVPMicroButton, LFDMicroButton, MainMenuMicroButton, HelpMicroButton }
    addon:HideFrame(SocialMicroButton)
end

addon:CompareBuild("3.3.5", "12340", addon:MicroButtonsPreCatVer(), addon:MicroButtonsPreCatVer(), addon:MicroButtonsCatVer())
any ideas?
__________________
"Are we there yet?"

GrimUI
[SIGPIC][/SIGPIC]
  Reply With Quote
10-06-10, 04:46 PM   #2
Vrul
A Scalebane Royal Guard
 
Vrul's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2007
Posts: 404
The way that function is written it should be called in the following manner:
Code:
addon:CompareBuild("3.3.5", "12340", "MicroButtonsPreCatVer", "MicroButtonsPreCatVer", "MicroButtonsCatVer")
The way you currently have it you are executing the one function twice and the other function once.

Another issue is that the way you have that function written, the third case (where both conditions are equal) will never be reached.

Yet another issue, you declare a local table in those functions that cannot be referenced from outside their respective functions. You need to either move the local declaration outside of the functions or have the functions return the table and adjust your other code accordingly.
  Reply With Quote
10-06-10, 05:13 PM   #3
Grimsin
A Molten Giant
 
Grimsin's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 990
do i just need to put < or > rather then <=? to fix the part about it reaching the final part where both are =?

And i had already thought about the part about the locals inside the function no longer working for the function, i simply placed the rest of the function into each of the two version functions. it seems to be working now with the "functionname" changed.
__________________
"Are we there yet?"

GrimUI
[SIGPIC][/SIGPIC]
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Making beta/live compat ver checker


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