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

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

mikshaw Wrote:
Yes, that's exactly the result I was originally thinking of, but wasn't sure where to start. Thanks. =o)
I'm definitely saving this for future tests, and putting it in with the rest of the code snippets.

I don't really understand the syntax of "do...end" though. Is that just to keep the variables local?

The do and end delimits a block. Inside you have your own scope. It is basically the same as { } in C, where you can also define new variables.

I used the do .. end only because I wanted to declare the variables local, since it doesn't make sense to have them as globals. Lua doesn't allow you to have local variables in the outermost scope:

> local a=6
> print(a)

which also doesn't make sense.

Of course it would make sense to put it into a function.

function minimal_version(min_version)
  local version=0; for x in string.gmatch(murgaLua and murgaLua.version or "0","%d+") do version=version*100+tonumber(x) end
  local min_vers=0; for x in string.gmatch(min_version,"%d+") do min_vers=min_vers*100+tonumber(x) end
  if version<min_vers then print"You must use a murgaLua version > 0.5.5" os.exit(1) end



02-07-2008 09:07 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 09:07 AM

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

Forum Jump: