PDA

View Full Version : Need help about "version"



nico210
08-08-2009, 04:46 AM
Hello Indigorose Forum ! I need a help about "version". Are they a script for return if a "version" is "up or down" exemple :

version="1.0"
myversion="1.1"

=> myversion is "up"

version="1.0.8"
myversion="1.0.2.1"

=> myversion is "down"

Do you understand ?
Thank you in advance

ShadowUK
08-08-2009, 05:25 AM
I do something similar but I do this.


MyProgram.Version = "1.0"; -- Just for display
MyProgram.Build = 1000; -- Nice number to compare with.

Then compare it like this.


Data = UpdateServer.GrabUpdate();

local Version = Data["Version"];
local Build = Data["Build"];

if (Build > MyProgram.Build) then
-- update required. version is held in "..Version.."
elseif (Build == MyProgram.Build) then
-- no update required.
else
-- we're more up to date. lol wut
end

What you want:


local VersionAsNumber = tonumber(String.Replace(Version, ".", "", false));

if (VersionAsNumber > 9000) then
-- IT'S OVER 9000!
end

bule
08-08-2009, 05:58 AM
APMS has this functionality built-in:


result = String.CompareFileVersions("1.0.20.3", "1.0.2.3");

Imagine Programming
08-08-2009, 06:34 AM
local versionasnumber = tonumber(string.replace(version, ".", "", false));

if (versionasnumber > 9000) then
-- it's over 9000!
End

over 9000?!

jpdragon
09-24-2009, 12:54 PM
Can I use this code below to do the follow tasks:
1. check and compare my current **** version 1.0.0.0 with the network version 2.0.0.0?
2. Prompt for new version is available
3. Download and override existing version 1.0.0.0



I do something similar but I do this.


MyProgram.Version = "1.0"; -- Just for display
MyProgram.Build = 1000; -- Nice number to compare with.

Then compare it like this.


Data = UpdateServer.GrabUpdate();

local Version = Data["Version"];
local Build = Data["Build"];

if (Build > MyProgram.Build) then
-- update required. version is held in "..Version.."
elseif (Build == MyProgram.Build) then
-- no update required.
else
-- we're more up to date. lol wut
end

What you want:


local VersionAsNumber = tonumber(String.Replace(Version, ".", "", false));

if (VersionAsNumber > 9000) then
-- IT'S OVER 9000!
end