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
Senior Member

Posts: 522
Group: Registered
Joined: Apr 2007
Status: Offline
Reputation: 5
Post: #1
testing presence of ML feature

I sometimes write scripts to be supported by multiple versions of murgaLua, for example in the case where I want to utilize a recent addition but don't want the application to break if the user has an older version. What I've done so far is check for the existence of a package that was added with the same version as the desired feature:

if not package.loaded.md5 then
print("This feature requires murgaLua version 0.6 or later")
<code for version 0.6>

This isn't ideal for more than one reason.

I don't know why it never occurred to me before, but you can use the same concept to check for the specific feature you want to use. For example, if you want to use Fl_Pixmap on 0.6 but prevent a close on 0.5.5 and earlier:

if fltk.Fl_Pixmap then
<code for version 0.6>

Of course you'll need to know the path to the specific object you want to test, but you can use this tool to help.

01-20-2008 05:37 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

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

Forum Jump: