47
4.4.10. Custom Scripts
Custom script allows you to customize the functions of the radio controller. The
scripting language used is Lua, which is a lightweight embeddable scripting language.
You need to implement custom functions in the radio controller. There are three
basic types:
One-time: The script runs only once and then terminates. Initialization of some
parameters, and a wizard for creating a new model. The script is stored in the
SCRIPTS folder of the SD card.
Mix: A script that executes in a loop, similar to the main program, and is always
executed during remote operation.
Function: The script is called in Special Functions. This script is only allowed to
execute when the switch in the special function is turned on, and closed when the
switch is turned off.
There are some caveats-if the script stops executing, you should never use Lua
model scripts to control any aspect of the model that might cause a crash. The
reason is that if the script tries to use too much CPU time or memory, it will be
closed and it will not run again when the model is selected.
“
The Custom Scripts page is for mixed-type scripts that run continuously.
These scripts should be placed in the / SCRIPTS / MIXE / folder of the SD card.
There can be up to 9 custom scripts.
For script development and documentation, please refer to the OpenTX 2.3 Lua
Reference Guide:
https://legacy.gitbook.com/book/opentx/opentx-2-3-lua-reference-
guide/details