News : The level of daily SPAM has reached insane proportions, all registrations are now manual. I ask you to send me an e-mail (john (at) murga (dot) org), to confirm that you want me to create an account for you.


Post Reply  Post Thread 
testing presence of ML feature
Author Message
Juergen
Member
***


Posts: 81
Group: Registered
Joined: May 2007
Status: Offline
Reputation: 0
Post: #1
RE: testing presence of ML feature

mikshaw Wrote:
Yeah, I had the assumption that local variables could only be used within a function.

I like that last one best. It seems it would be completely reusable without modification, except the print command should use min_version instead of a static "0.5.5" in its string. As a personal preference I'd also change the variable name of min_vers. It's a bit too similar to min_version for quick reading; it took me a few minutes to figure out they were unique.


Another version:

Code:
function minimal_version(min_version)
  local x=string.gmatch((murgaLua and murgaLua.version or "0").." " .. min_version,"%d+")
  local t=function(x) return tonumber(x()) end
  if t(x)*10000+t(x)*100+t(x)-t(x)*10000-t(x)*100-t(x)<0 then
    print("You must use a murgaLua version > "..min_version) os.exit(1) end
end

minimal_version("0.5.6")


Juergen

02-07-2008 10:52 AM
Find all posts by this user Quote this message in a reply
Post Reply  Post Thread 

Messages In This Thread
testing presence of ML feature - mikshaw - 01-20-2008, 05:37 AM
RE: testing presence of ML feature - Juergen - 02-07-2008 10:52 AM

View a Printable Version
Send this Thread to a Friend
Subscribe to this Thread | Add Thread to Favorites

Forum Jump: