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 
Little converter script enhancement
Author Message
Tobi
Junior Member
**


Posts: 20
Group: Registered
Joined: May 2007
Status: Offline
Reputation: 0
Post: #1
Little converter script enhancement

Hello folks!

The current convertFluidToMurgaLua.lua script has problems with objects that have a custom name (you can set an object's name in the Name field of the C++ tab).
It does not replace the "->" by ":" for such objects.
But custom named objects make it really cool to use fluid, one can reference them directly in the lua script without the need to create the reference to each local object by hand.
I made a few changes that fix this. In the script find this

Code:
-- Convert object notation
currentLine = string.gsub(currentLine, 'o%->', "object:")


Add the following after this to handle custom named objects:

Code:
-- Convert object notation of named objects
currentLine = string.gsub(currentLine, '%w+%->', "%1:")
currentLine = string.gsub(currentLine, '->:', ":")
-- handle special case where custom object name ends with o (all o's get replaced with object, so need that in the constructor as well)
currentLine = string.gsub(currentLine, "o = fltk:Fl_", "object = fltk:Fl_")


Greetings,

Tobi

This post was last modified: 05-11-2007 01:11 AM by Tobi.

05-11-2007 01:07 AM
Find all posts by this user Quote this message in a reply
Post Reply  Post Thread 

Messages In This Thread
Little converter script enhancement - Tobi - 05-11-2007 01:07 AM

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

Forum Jump: