Page 1 of 1

LUA and openTx

Posted: Fri Oct 13, 2023 11:41 pm
by Raythegreat
Hi,

I'm building a motor thrust meter setup and would like to automate the entire process using my Taranis X9D+ (openTx), an Rx+ ESC + Lipo and LUA scripts.
Can anyone can help me about about how to control the throttle using LUA?
I studied the LUA manual and could not find a clear solution.

Of course, this setup is not going into any aircraft, it will be a fixed grounded setup, so no security danger other than putting my fingers into the propeller. :)

Thank you,
Ray

Re: LUA and openTx

Posted: Mon Oct 16, 2023 4:06 am
by Raythegreat
Hi all,

I'm struggling with lua scripts.
Here is a problem I have.

I wrote a lua script and I can run it successfully in the telemetry page and from any screen display. No error messages whatsoever and the script works well.
But if I try to run the script from the SD card using with the execute command I always have the error message "Script syntax error" even if there is no syntax error in the script. The Activate RX script from Mike B works perfectly in the execute menu.
So there must be a reason why the execute does not work for my scripts even if I put only one single line.

Please help with this issue.

Thanks
Ray

Re: LUA and openTx

Posted: Mon Oct 16, 2023 10:22 am
by Kilrah
There are multiple types of scripts. To be executable from the SD browser it has to be a one-time script.

https://doc.open-tx.org/opentx-2-3-lua- ... e_overview

Re: LUA and openTx

Posted: Mon Oct 16, 2023 8:27 pm
by Raythegreat
Hi Kilrah,

Thank you.
This helped a lot.
I added a return 1 at the end of my script and I don't have the script syntax error anymore and the script worked.
My question now is what is the best way to guaranty a one-time script? With a return other than 0 or something else?

Ray