<div dir="ltr"><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">This is not something I use currently, so I don't have any skin in the game. But from a perspective of comprehensibility, I think it makes more sense to expect the first value returned. It's essentially the same as doing `local foo = my_function()` when the function returns multiple values -- the variable gets the first return value and the rest are discarded.</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">Aaron.</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Mar 12, 2023 at 3:42 PM Robert Patterson <<a href="mailto:robert@robertgpatterson.com">robert@robertgpatterson.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>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?</div><div><br></div><div>Mir ist es egal.</div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Mar 12, 2023 at 2:24 PM Robert Patterson <<a href="mailto:robert@robertgpatterson.com" target="_blank">robert@robertgpatterson.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>I created this script called "test_return_value.lua":</div><div><br></div><div>function plugindef()<br> finaleplugin.RequireDocument = false<br> finaleplugin.LoadLuaSocket = true<br> finaleplugin.IgnoreReturnValue = true<br>end<br><br>return 11, 12, 13</div><div><br></div><div><br></div><div>And I call it with this script:</div><div><br></div><div><br>local script_path = finenv.RunningLuaFolderPath() .. "test_return_value.lua"<br>local items = finenv.CreateLuaScriptItemsFromFilePath(script_path)<br>local success, errmsg, msgtype = finenv.ExecuteLuaScriptItem(items:GetItemAt(0))<br>if errmsg ~= null then print("type", msgtype, errmsg) end</div><div><br></div><div>It always returns: success==true, errmsg=="13", msgtype==0.</div><div><br></div><div>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.</div><div><br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Mar 12, 2023 at 1:12 PM Jan Angermüller <<a href="mailto:jan@angermueller.com" target="_blank">jan@angermueller.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div>
Robert,<br>
<br>
thanks a lot for v0.66!<br>
<br>
I have been testing the compatibility with Perfect Layout and also
tried the new "return value" handling.<br>
It seems to me like there is still a problem. I tried it in
Fin27/Win10/RGP Lua v.66.<br>
<br>
I call the plug-in with:<br>
local success,d1,d2=finenv.ExecuteLuaScriptItem(script) <br>
<br>
When the plug-in ended without error, but with:<br>
return 11,12,13<br>
<br>
The script above gave these values:<br>
success=true<br>
d1=13<br>
d2=0<br>
<br>
I think this is correct. (However, I have not found it in the
documentation.)<br>
<b><br>
</b><b>BUT: </b>this only happened the very first time when I
called the script directly after starting Finale.<br>
When I run the ExecuteLuaScriptItem a second time, it always results
in:<br>
<br>
success=true<br>
d1="" --or at least it's an "empty nothing" when I print
it with tostring(d1). It's not nil.<br>
d2=0<br>
<br>
So after the first run I can't influence the return value anymore.<br>
Seems like the return value is permanently stored somewhere in RGP
Lua.<br>
<br>
When I restart Finale, it's the same behaviour: first time correct
value 13, after that "".<br>
<br>
Jan<br>
</div>
_______________________________________________<br>
JWLua mailing list<br>
<a href="mailto:JWLua@jwmusic.nu" target="_blank">JWLua@jwmusic.nu</a><br>
<a href="http://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu" rel="noreferrer" target="_blank">http://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu</a><br>
</blockquote></div>
</blockquote></div>
_______________________________________________<br>
JWLua mailing list<br>
<a href="mailto:JWLua@jwmusic.nu" target="_blank">JWLua@jwmusic.nu</a><br>
<a href="http://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu" rel="noreferrer" target="_blank">http://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu</a><br>
</blockquote></div>