[JW Lua] Return value issue with v0.66

Robert Patterson robert at robertgpatterson.com
Mon Mar 13 01:09:39 CET 2023


Just to clarify, I have created a test case (described above) that seems
like it is what you described. I am running it on WinFin with the released
version of RGP Lua. I see completely consistent return values, like the
first in your scenario but they are the same every time.

There must be some other factor at play. That is why I am requesting a set
of test scripts that reproduce it on your end.

Robert



On Sun, Mar 12, 2023 at 4:45 PM Robert Patterson <
robert at robertgpatterson.com> wrote:

> Please send me a minimal pair of scripts that reproduces the problem.
>
> On Sun, Mar 12, 2023 at 3:32 PM Jan Angermüller <jan at angermueller.com>
> wrote:
>
>> Hm, I can't reproduce what you write.
>> Could it be that you checked on macOS? Maybe it's different there?
>>
>> Here is a screen cam video that shows what I wrote:
>> https://www.youtube.com/watch?v=fXA0K92z_bQ
>>
>> when Finale 27/Win10 is (re-)started the first plug-in call returns the
>> correct *errmsg *(here: "false" which comes from clicking "Cancel" in
>> the Perfect Layout user dialog).
>> The second time I run Perfect Layout with the same clicks, *errmsg *is
>> *"". *If I restarted Finale once more (which is not in the video), it
>> would again show the correct *errmsg *the first time, but an empty value
>> on subsequent calls.
>>
>> Jan
>>
>> Am 12.03.2023 um 20:41 schrieb Robert Patterson:
>>
>> Okay, so it isn't exactly a bug. ExecuteLuaScriptItem returns the top
>> value on the Lua stack, which is the *last* value returned. So the question
>> is, do I modify it to return the first value returned (i.e., the last value
>> on the stack), or do I modify the docs to say it returns the last value
>> returned?
>>
>> Mir ist es egal.
>>
>>
>> On Sun, Mar 12, 2023 at 2:24 PM Robert Patterson <
>> robert at robertgpatterson.com> wrote:
>>
>>> 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
>>>>
>>>
>> _______________________________________________
>> JWLua mailing listJWLua at jwmusic.nuhttp://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu
>>
>>
>> --
>> Jan Angermüller
>> Orchideenstieg 13
>> 22297 Hamburg
>> Tel. 040 - 28 94 84 82
>> Mobil 0173 - 99 33 904www.elbsound.studio
>>
>> _______________________________________________
>> 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/6cddffe6/attachment.htm>


More information about the JWLua mailing list