<div dir="ltr">Please send me a minimal pair of scripts that reproduces the problem.<br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Mar 12, 2023 at 3:32 PM Jan Angermüller <<a href="mailto:jan@angermueller.com">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>
    Hm, I can't reproduce what you write.<br>
    Could it be that you checked on macOS? Maybe it's different there?<br>
    <br>
    Here is a screen cam video that shows what I wrote:<br>
    <a href="https://www.youtube.com/watch?v=fXA0K92z_bQ" target="_blank">https://www.youtube.com/watch?v=fXA0K92z_bQ</a><br>
    <br>
    when Finale 27/Win10 is (re-)started the first plug-in call returns
    the correct <i>errmsg </i>(here: "false" which comes from clicking
    "Cancel" in the Perfect Layout user dialog).<br>
    The second time I run Perfect Layout with the same clicks, <i>errmsg
    </i>is <i>"".<br>
    </i>If I restarted Finale once more (which is not in the video), it
    would again show the correct <i>errmsg </i>the first time, but an
    empty value on subsequent calls.<i><br>
    </i><br>
    Jan<br>
    <br>
    <div>Am 12.03.2023 um 20:41 schrieb Robert
      Patterson:<br>
    </div>
    <blockquote type="cite">
      
      <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>
      <fieldset></fieldset>
      <pre>_______________________________________________
JWLua mailing list
<a href="mailto:JWLua@jwmusic.nu" target="_blank">JWLua@jwmusic.nu</a>
<a href="http://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu" target="_blank">http://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu</a>
</pre>
    </blockquote>
    <br>
    <pre cols="72">-- 
Jan Angermüller
Orchideenstieg 13
22297 Hamburg
Tel. 040 - 28 94 84 82
Mobil 0173 - 99 33 904
<a href="http://www.elbsound.studio" target="_blank">www.elbsound.studio</a></pre>
  </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>