[JW Lua] Return value issue with v0.66

Robert Patterson robert at robertgpatterson.com
Sun Mar 12 20:24:53 CET 2023


I created this script called "test_return_value.lua":

function plugindef()
    finaleplugin.RequireDocument = false
    finaleplugin.LoadLuaSocket = true
    finaleplugin.IgnoreReturnValue = true
end

return 11, 12, 13


And I call it with this script:


local script_path = finenv.RunningLuaFolderPath() .. "test_return_value.lua"
local items = finenv.CreateLuaScriptItemsFromFilePath(script_path)
local success, errmsg, msgtype =
finenv.ExecuteLuaScriptItem(items:GetItemAt(0))
if errmsg ~= null then print("type", msgtype, errmsg) end

It always returns: success==true, errmsg=="13", msgtype==0.

The bug here is that it should be returning errmsg=="11". I'm not sure why
it isn't, and I need to research it.



On Sun, Mar 12, 2023 at 1:12 PM Jan Angermüller <jan at angermueller.com>
wrote:

> Robert,
>
> thanks a lot for v0.66!
>
> I have been testing the compatibility with Perfect Layout and also tried
> the new "return value" handling.
> It seems to me like there is still a problem. I tried it in
> Fin27/Win10/RGP Lua v.66.
>
> I call the plug-in with:
> local success,d1,d2=finenv.ExecuteLuaScriptItem(script)
>
> When the plug-in ended without error, but with:
> return 11,12,13
>
> The script above gave these values:
> success=true
> d1=13
> d2=0
>
> I think this is correct. (However, I have not found it in the
> documentation.)
>
> *BUT: *this only happened the very first time when I called the script
> directly after starting Finale.
> When I run the ExecuteLuaScriptItem a second time, it always results in:
>
> success=true
> d1=""            --or at least it's an "empty nothing" when I print it
> with   tostring(d1). It's not nil.
> d2=0
>
> So after the first run I can't influence the return value anymore.
> Seems like the return value is permanently stored somewhere in RGP Lua.
>
> When I restart Finale, it's the same behaviour: first time correct value
> 13, after that "".
>
> Jan
> _______________________________________________
> JWLua mailing list
> JWLua at jwmusic.nu
> http://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://jwmusic.nu/pipermail/jwlua_jwmusic.nu/attachments/20230312/64edafdc/attachment.html>


More information about the JWLua mailing list