[JW Lua] ExecuteLuaScriptItem: returning an error message - still not working

Robert Patterson robert at robertgpatterson.com
Thu Dec 22 18:43:22 CET 2022


I'm thinking that, as long as I'm fixing it, maybe I should just go ahead
and return the actual return value from the script in the second parameter.
Shouldn't be too hard.

On Thu, Dec 22, 2022 at 11:40 AM Jan Angermüller <jan at angermueller.com>
wrote:

> No problem, Robert.
> Great that you have found it!
>
>
> Am 22.12.2022 um 18:30 schrieb Robert Patterson:
>
> Whoops, there's a bug. Sorry. I can fix it for the next version, but I
> don't see any way to do what you want right now.
>
> On Thu, Dec 22, 2022 at 11:16 AM Jan Angermüller <jan at angermueller.com>
> wrote:
>
>> Robert,
>>
>> your suggestion is exactly the code that I tried before I wrote the first
>> message in this thread.
>> I tried:
>> *return tostring(false) *
>> *return false*
>> *return "Cancel"*
>>
>> When I do this
>> *local success, msg = finenv.ExecuteLuaScriptItem(item)*
>> gets me:
>> success == true
>> msg == nil
>>
>> I only get *success==false *with* error(...)*
>> (tested on Windows/Fin27/RGP Lua 0.65 only)
>>
>> Jan
>>
>> Am 22.12.2022 um 18:04 schrieb Robert Patterson:
>>
>> It looks like the code always shows the error message. :-/
>>
>> For your purposes, I think the best choice might be simply to return a
>> message. Or just return tostring(false) and then compare the string
>> returned to that, if you don't care about the message.
>>
>> Something like:
>>
>> local success, msg = finenv.ExecuteLuaScriptItem(item)
>> if success and msg then <do-error-return-code> end
>>
>>
>> On Thu, Dec 22, 2022 at 10:47 AM Jan Angermüller <jan at angermueller.com>
>> wrote:
>>
>>> Hm, I still didn't succeed.
>>>
>>> When I throw an error message in a lua script with:
>>> *error("Cancel",2)*
>>> then this a user dialog always pops up in RGP Lua/Windows:
>>>
>>>
>>> Is there a way to not show this dialog in RGP Lua?
>>> (Tested in Fin27.2/Windows 10/RGP Lua 0.65)
>>>
>>> This happens without* finenv.ExecuteLuaScriptItem* , it's just the *error(...)
>>> *that leads to the popup.
>>>
>>> The same code in JW Lua doesn't give a dialog that pops up.
>>>
>>> Or does anyone have an example code of how to end a lua script so that
>>> it passes a "not successful" to *finenv.ExecuteLuaScriptItem *without
>>> showing any error messages.
>>>
>>> Jan
>>>
>>>
>>>
>>> Am 20.12.2022 um 01:27 schrieb Robert Patterson:
>>>
>>> As far as I can tell, ExecuteLuaScriptItem is working as documented
>>> <https://www.finalelua.com/docs/rgp-lua/finenv-properties#executeluascriptitem-function>.
>>> It is not the same behavior as a command line tool. As for the 'error'
>>> function, it will close the Lua state of the called script, but that would
>>> appear to be what you want anyway. Otherwise you can return a string that
>>> will be returned in the second return value of ExecuteLuaScriptItem.
>>>
>>> _______________________________________________
>>> 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
>>>
>>
>> _______________________________________________
>> 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
>>
>
> _______________________________________________
> 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/20221222/b685cb6d/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mNLYw0I5JU0LmXji.png
Type: image/png
Size: 3362 bytes
Desc: not available
URL: <http://jwmusic.nu/pipermail/jwlua_jwmusic.nu/attachments/20221222/b685cb6d/attachment.png>


More information about the JWLua mailing list