[JW Lua] Repeat 4 measures

Chris marcel.denio at gmail.com
Tue Apr 28 14:52:38 CEST 2015


Thank you Jan

I think this is a good personal solution, but everyone has perhaps not a 
default template with a blank style (and ID =1 )

But I have a question.
To avoid duplicating the "shape expression" and the "smartline", I 
perform an existence test.
For the "shapeexpression", I test the name, so no problem.
But for the "smartline", I test the properties one by one.

Does the script below can test the equality of two objects:

--------------------------------------------------------------------
local clsd1=finale.FCCustomSmartLineDef()
clsd1:Load(1)
local clsd2=finale.FCCustomSmartLineDef()
clsd2:Load(2)
local properties1 = dumpproperties(clsd1)
local properties2 = dumpproperties(clsd2)

local mt = {}
mt.__eq = function(t1, t2)
   for p1, v1 in pairs(t1) do
      for p2, v2 in pairs(t2) do
        if p1 ~= "ItemNo" and p1 == p2 and v1 ~= v2 then
             return false
         end
      end
   end

   return true
end

setmetatable(properties1, mt)
setmetatable(properties2, mt)

print(properties1 == properties2)
--------------------------------------------------------------------

Best regards

Chris




More information about the JWLua mailing list