Page 1 of 1

Check Installed Plugins Against The Store problem

Posted: 10 Oct 2013 17:39
by tatewise
The V2.1 Plugin and probably earlier versions has a problem checking Versions in the sequence 1.8, 1.9, 1.10, 1.11, etc.

On line 49 the version < versionStore test considers Version 1.10 to be older than 1.8 and asks to download 1.8 over 1.10.

It seems that the two components of the version should be kept separate, or the version numbers must be syntax checked so 1.9 must be followed by 2.0 and 1.10 must be banned.

Re: Check Installed Plugins Against The Store problem

Posted: 10 Oct 2013 18:55
by Jane
I don't think there were any two part numbers with 2 digits after the ., I'll change the code to cope.

Re: Check Installed Plugins Against The Store problem

Posted: 10 Oct 2013 19:08
by tatewise
You are correct, the 2 digit version "1.10" was in my Plugins.
This should cope with many forms of version number providing they are repetitions of digits separated by dots.

Code: Select all

function IntVersion(strVersion)
	local intVersion = 0
	local tblVersion = strVersion:split(".")
	for i=1,5 do
		intVersion = intVersion * 1000 + tonumber(tblVersion[i] or 0)
	end
--	print(strVersion," > ",intVersion)
	return intVersion
end -- function IntVersion
then in main function

Code: Select all

 if versionStore ~= nil and IntVersion(version) < IntVersion(versionStore) then
   local res = fhMessageBox('Newer version of '..name:gsub('%.fh_lua','')..' found, would you like to upgrade from '..version..' to '..versionStore,'MB_YESNO','MB_ICONQUESTION')
which explicitly reports the old and new versions.

Re: Check Installed Plugins Against The Store problem

Posted: 10 Oct 2013 20:10
by Jane
I have already fixed the plugin, something very similar, I will double check it in the morning and then post it up.