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
Post Reply  Post Thread 

Messages In This Thread
Callback typecast removal - Tobi - 05-06-2007 07:35 PM
RE: Callback typecast removal - Tobi - 05-08-2007, 03:37 AM
RE: Callback typecast removal - JohnMurga - 05-08-2007, 03:43 AM

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

Forum Jump: