<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    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 class="moz-txt-link-freetext" href="https://www.youtube.com/watch?v=fXA0K92z_bQ">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 class="moz-cite-prefix">Am 12.03.2023 um 20:41 schrieb Robert
      Patterson:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAACncevTxq9UwK3MKakx9FMbDof95thKXeHwJQkg7BgMWb33WA@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <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"
            moz-do-not-send="true" class="moz-txt-link-freetext">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"
                moz-do-not-send="true" class="moz-txt-link-freetext">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"
                moz-do-not-send="true" class="moz-txt-link-freetext">JWLua@jwmusic.nu</a><br>
              <a
                href="http://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu"
                rel="noreferrer" target="_blank" moz-do-not-send="true"
                class="moz-txt-link-freetext">http://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu</a><br>
            </blockquote>
          </div>
        </blockquote>
      </div>
      <br>
      <fieldset class="moz-mime-attachment-header"></fieldset>
      <pre class="moz-quote-pre" wrap="">_______________________________________________
JWLua mailing list
<a class="moz-txt-link-abbreviated" href="mailto:JWLua@jwmusic.nu">JWLua@jwmusic.nu</a>
<a class="moz-txt-link-freetext" href="http://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu">http://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu</a>
</pre>
    </blockquote>
    <br>
    <pre class="moz-signature" cols="72">-- 
Jan Angermüller
Orchideenstieg 13
22297 Hamburg
Tel. 040 - 28 94 84 82
Mobil 0173 - 99 33 904
<a class="moz-txt-link-abbreviated" href="http://www.elbsound.studio">www.elbsound.studio</a></pre>
  </body>
</html>