[JW Lua] CreateTextString with "empty" text expressions can now cause problems (v052) - worked fine in v049

Jan Angermüller jan at angermueller.com
Tue Aug 15 14:04:41 CEST 2017


Jari,

in v0.52 I now have a problem with "empty" text expressions (see 
expression 1 in the attached file).

Code snippet:
local exprdefs = finale.FCTextExpressionDefs()
exprdefs:LoadAll()
for exprdef in each(exprdefs) do
     local text=exprdef:CreateTextString()
     print(text.LuaString)
end

In v0.49 it simply printed an empty line:
Running [Unnamed Script] ======>

<======= [Unnamed Script] succeeded (Processing time: 0.001 s).

In v0.52 it now returns an error message:
Running [Unnamed Script] ======>
[string "local exprdefs = finale.FCTextExpressionDefs(..."]:5: attempt 
to index local 'text' (a nil value)
<======= [Unnamed Script] FAILED.

(I didn't check v0.50 and v0.51)

Of course, I could develop very defensive here and add an "if 
(text~=nil) then" in this case, but I thought this would be a scenario 
that should always return a valid value - as it did until v.49.
What do you think about it?

Best,
Jan

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://jwmusic.nu/pipermail/jwlua_jwmusic.nu/attachments/20170815/cb80366e/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: createtextstring.mus
Type: application/octet-stream
Size: 53122 bytes
Desc: not available
URL: <http://jwmusic.nu/pipermail/jwlua_jwmusic.nu/attachments/20170815/cb80366e/attachment-0001.obj>


More information about the JWLua mailing list