[JW Lua] Finale crash when argument is nil

Charles O. Lawrence charlesolawrence at bellsouth.net
Tue Sep 8 20:03:45 CEST 2015


Thomas,
It would seem to me that since you are calling your own user-written
function, you can pass it any argument you want.  How is JW Lua it to know
if the argument is unknown (misspelled)?  It would have no way to know you
really wanted to call the function with the iteration variable as the
argument, just because the function call is within the for...do loop.  I
think a run-time error is all that can be expected.  JW Lua should perhaps
be able to catch the error and terminate the script gracefully as opposed to
crashing Finale.

BTW:  With the argument spelled correctly, it runs but does nothing that I
can see.

Charles

-----Original Message-----
From: JWLua [mailto:jwlua-bounces at jwmusic.nu] On Behalf Of Thomas Weber
Sent: Tuesday, September 8, 2015 12:26 AM
To: JW Lua Mailing List <jwlua at jwmusic.nu>
Subject: [JW Lua] Finale crash when argument is nil

I found Finale is simply crashing with this script:


local function getStaffSpec(noteEntry)
    local staffSpec = finale.FCCurrentStaffSpec()
    staffSpec:LoadForEntry(noteEntry)
    return staffSpec
end

for entry in eachentry(finenv.Region()) do
    getStaffSpec(enty) -- misspelled
end


One can of course add a check in the script to make it fail gracefully, but
I think ideally, such a check should be built into JW Lua itself.

Have a great day!
Thomas

_______________________________________________
JWLua mailing list
JWLua at jwmusic.nu
http://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu





More information about the JWLua mailing list