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 
Callback typecast removal
Author Message
Tobi
Junior Member
**


Posts: 20
Group: Registered
Joined: May 2007
Status: Offline
Reputation: 0
Post: #1
Callback typecast removal

Hi,

It's possible to set the callbacks of the GUI elements already in fluid, however when the resulting .cxx file is converted to .lua, the C++ typecast (Fl_Callback*) is also copied to the lua file. See this:

Code:
Fl_Button* o = new Fl_Button(145, 5, 70, 25, "Quit");
o->callback((Fl_Callback*)quitter);


becomes

Code:
do local object = fltk:Fl_Button(145, 5, 70, 25, "Quit");
object:callback((Fl_Callback*)quitter);


I've looked at the converter script and it claims to remove the typecasts, for some reason it doesn't work though. Line 100 in convertFluidToMurgaLua.lua:

Code:
-- Remove casts as they are not required in LUA
currentLine = string.gsub(currentLine, "%(Fl_%w*%)", "")


Keep up the good work! Smile

Tobi

This post was last modified: 05-06-2007 07:37 PM by Tobi.

05-06-2007 07:35 PM
Find all posts by this user Quote this message in a reply
Tobi
Junior Member
**


Posts: 20
Group: Registered
Joined: May 2007
Status: Offline
Reputation: 0
Post: #2
RE: Callback typecast removal

OK, this is the solution:

In the convertFluidToMurgaLua.lua file in line 101 the pattern in the gsub method has an error.
Here's the corrected version:

Code:
currentLine = string.gsub(currentLine, "%(Fl_%w*%*%)", "")

05-08-2007 03:37 AM
Find all posts by this user Quote this message in a reply
JohnMurga
Administrator
*******


Posts: 381
Group: Administrators
Joined: Apr 2007
Status: Offline
Reputation: 2
Post: #3
RE: Callback typecast removal

Tobi Wrote:
OK, this is the solution:

In the convertFluidToMurgaLua.lua file in line 101 the pattern in the gsub method has an error.
Here's the corrected version:

Code:
currentLine = string.gsub(currentLine, "%(Fl_%w*%*%)", "")


Thanks, I'll test it and put it in the next build ...

I have been traveling for a few days, so I have to catch up on a few things.

Cheers
JohnM

05-08-2007 03:43 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Post Reply  Post Thread 

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

Forum Jump: