testing presence of ML feature
|
Author |
Message |
mikshaw
Senior Member
   
Posts: 522
Group: Registered
Joined: Apr 2007
Status:
Offline
Reputation: 5
|
RE: testing presence of ML feature
I don't think it works? I tested it with murgaLua 0.6 and 0.5.5, and both exited.
They both work, as expected, when you run minimal_version("0.5.5")
|
|
02-08-2008 01:36 AM |
|
 |
Juergen
Member
  
Posts: 81
Group: Registered
Joined: May 2007
Status:
Offline
Reputation: 0
|
RE: testing presence of ML feature
I don't think it works? I tested it with murgaLua 0.6 and 0.5.5, and both exited.
They both work, as expected, when you run minimal_version("0.5.5")
Have you checked the murgaLua.version string? I don't know what binary you have, but mine says still "0.5.5".
Juergen
|
|
02-08-2008 01:49 AM |
|
 |
mikshaw
Senior Member
   
Posts: 522
Group: Registered
Joined: Apr 2007
Status:
Offline
Reputation: 5
|
RE: testing presence of ML feature
I've been doing various version checking tests on all versions from 0.1 to current (excluding 0.2, which I never had for some reason).
Both 0.5.5 and 0.6.PRE-RELEASE have a version string of "0.5.5". According to John there won't be a final 0.6 release, so as far as 0.6 is concerned its version string will be permanently wrong. This leads me to believe that testing for "0.6" as a minimum version string should be actively discouraged. It won't work properly if the script has features that were first adopted in 0.6, because it will assume your version is too old if you're using 0.6.
So my suggestion when it comes to using the version string as a test is either to retain 0.5.5 support in your script or skip to 0.6.5 when it is released. Otherwise you'll need to test for specific features in the required minimum version, which isn't quite as reliable unless you can be guaranteed that all features currently in 0.6 will remain in all future versions.
From what I gather, though, 0.6.5 looks to be quite an impressive update, with features I'll probably want to utilize often, so perhaps this issue will soon be moot. For more basic scripts 0.5.5 support should be sufficient, and for features that are new to 0.6 it looks like 0.6.5 will be a better alternative anyway.
This post was last modified: 02-08-2008 04:40 AM by mikshaw.
|
|
02-08-2008 04:35 AM |
|
 |
Juergen
Member
  
Posts: 81
Group: Registered
Joined: May 2007
Status:
Offline
Reputation: 0
|
RE: testing presence of ML feature
I've been doing various version checking tests on all versions from 0.1 to current (excluding 0.2, which I never had for some reason).
Both 0.5.5 and 0.6.PRE-RELEASE have a version string of "0.5.5". According to John there won't be a final 0.6 release, so as far as 0.6 is concerned its version string will be permanently wrong. This leads me to believe that testing for "0.6" as a minimum version string should be actively discouraged. It won't work properly if the script has features that were first adopted in 0.6, because it will assume your version is too old if you're using 0.6.
So my suggestion when it comes to using the version string as a test is either to retain 0.5.5 support in your script or skip to 0.6.5 when it is released. Otherwise you'll need to test for specific features in the required minimum version, which isn't quite as reliable unless you can be guaranteed that all features currently in 0.6 will remain in all future versions.
I don't know, what you mean. The funtion tests if a certain version is higher than another version.
The function makes the following assumtions:
There version strings are of the form "x" or "x"."y" or "x"."y"."z" where the "." can be any character except a number (it will also match "0 5 5" or "5yy5" or "test5test5") and that x,y,z are not bigger than a 2 digit number.
If x_version<x_min_version then it will exit, If x_version=x_min_version and y_version<y_min_version it will exit. If x_versinon=x_min_version and y_version=y_min_version and z_version<z_min_version it will exit. In all other cases it won't.
So it doesn't matter how the strings are formed or what version it is.
Juergen
|
|
02-08-2008 04:51 AM |
|
 |
mikshaw
Senior Member
   
Posts: 522
Group: Registered
Joined: Apr 2007
Status:
Offline
Reputation: 5
|
RE: testing presence of ML feature
Ok, let me try to explain this...third time's a charm =o)
When murgaLua 0.6-PRE-RELEASE was posted here a few weeks ago, its version string still said "0.5.5" rather than "0.6". Not long afterward, Mr. Murga announced in the "full release" thread that a final 0.6 release would not be made since he was already jumping toward new features for 0.6.5. The "UPDATED murgaLua build" thread states that the version numbers have been updated, but I've downloaded the newer file twice (once just now), and the version string still says "0.5.5".
So, apparently the only 0.6 version in circulation is the one with the faulty version string, and I know of at least one Linux distro that has already included it in the most recent versions of both of its flavors. What that means is that 0.6 is out there, whether its listed on the murgaLua front page or not.
The result is that there are many people who currently have 0.6, and might continue to keep it for a while. If they try to run a script that has 0.6 features and that includes a test for the "0.6" string, the test will fail. If the test is for "0.5.5", the test will pass but the script will break because it has features not available in 0.5.5.
Anyway, I wasn't saying that your string test isn't useable...it's the best thing possible as far as I can tell. My issue was that developers should be aware that they shouldn't use "0.6" as a test. They should either test for individual 0.6 features, or retain support for 0.5.5, or wait until 0.6.5 and use "0.6.5" as the minimum string.
This post was last modified: 02-08-2008 05:58 AM by mikshaw.
|
|
02-08-2008 05:50 AM |
|
 |
Juergen
Member
  
Posts: 81
Group: Registered
Joined: May 2007
Status:
Offline
Reputation: 0
|
RE: testing presence of ML feature
There was a small bug in the previous version. This should fix it all:
function minimal_version(minimal_version)
local x=string.gmatch((murgaLua and murgaLua.version or "0"),"%d+")
local y=string.gmatch(minimal_version,"%d+")
local t=function(x) return tonumber(x() or 0) end
local version=0; local min_version=0 ; local a,b
for i=1,3 do a,b=t(x),t(y);
version=version*(a==0 and 1 or 100)+a
min_version=min_version*(b==0 and 1 or 100)+b end
if version<min_version then
print("You must use a murgaLua version > "..minimal_version) os.exit(1) end
end
minimal_version("<>5test6.............")
Maybe this could be a little beautified.
Juergen
|
|
02-08-2008 06:13 AM |
|
 |
JohnMurga
Administrator
      
Posts: 381
Group: Administrators
Joined: Apr 2007
Status:
Offline
Reputation: 2
|
RE: testing presence of ML feature
Anyway, I wasn't saying that your string test isn't useable...it's the best thing possible as far as I can tell. My issue was that developers should be aware that they shouldn't use "0.6" as a test. They should either test for individual 0.6 features, or retain support for 0.5.5, or wait until 0.6.5 and use "0.6.5" as the minimum string.
Or use the "murgaLua_Version" ... That IS correct in the pre-release.
The full release is probably 0.6.5, and my target for pushing it out is Sunday night (Switzerland).
I have dropped one of my target features, but added several others along with a few FLTK fixes and additions.
Cheers
John de Murga
|
|
02-08-2008 07:54 AM |
|
 |
mikshaw
Senior Member
   
Posts: 522
Group: Registered
Joined: Apr 2007
Status:
Offline
Reputation: 5
|
RE: testing presence of ML feature
Or use the "murgaLua_Version"
ohhh...I didn't see that. So I suspect the test should include the existence of murgaLua_Version before checking its value, since it doesn't seem to be in earlier versions?
Thank you.
|
|
02-08-2008 10:42 AM |
|
 |
|