Murga-Projects Forums

Full Version: Little converter script enhancement
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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

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

Add the following after this to handle custom named objects:

-- 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_")



Reference URL's