OpenTX 2.1 Lua Reference Guide
OpenTX 2.1 Lua Reference Guide
0.1.
Introduction
0.1.1.
Acknowledgments
0.1.2.
Getting Started
1.
Part I - Script Type Overview
1.1.
Mix Scripts
1.2.
Telemetry Scripts
1.3.
One-Time Scripts
1.4.
Wizard Script
1.5.
Function Scripts
2.
Part II - OpenTX Lua API Programming Guide
2.1.
Input Table Syntax
2.2.
Output Table Syntax
2.3.
Init Function Syntax
2.4.
Run Function Syntax
2.5.
Return Statement Syntax
2.6.
Included Lua Libraries
2.6.1.
io Library
2.6.1.1.
io.open()
2.6.1.2.
io.close()
2.6.1.3.
io.read()
2.6.1.4.
io.write()
2.6.1.5.
io.seek()
3.
Part III - OpenTX Lua API Reference
3.1.
Constants
3.1.1.
Key Event Constants
3.2.
General Functions
3.2.1.
GREY()
3.2.2.
defaultChannel(stick)
3.2.3.
defaultStick(channel)
3.2.4.
getDateTime()
3.2.5.
getFieldInfo(name)
3.2.6.
getFlightMode(mode)
3.2.7.
getGeneralSettings()
3.2.8.
getTime()
3.2.9.
getValue(source)
3.2.10.
getVersion()
3.2.11.
killEvents(key)
3.2.12.
playDuration(duration [, hourFormat])
3.2.13.
playFile(name)
3.2.14.
playNumber(value, unit [, attributes])
3.2.15.
playTone(frequency, duration, pause [, flags [, freqIncr]])
3.2.16.
popupInput(title, event, input, min, max)
3.3.
Model Functions
3.3.1.
model.defaultInputs()
3.3.2.
model.deleteInput(input, line)
3.3.3.
model.deleteInputs()
3.3.4.
model.deleteMix(channel, line)
3.3.5.
model.deleteMixes()
3.3.6.
model.getCurve(curve)
3.3.7.
model.getCustomFunction(function)
3.3.8.
model.getGlobalVariable(index [, phase])
3.3.9.
model.getInfo()
3.3.10.
model.getInput(input, line)
3.3.11.
model.getInputsCount(input)
3.3.12.
model.getLogicalSwitch(switch)
3.3.13.
model.getMix(channel, line)
3.3.14.
model.getMixesCount(channel)
3.3.15.
model.getModule(index)
3.3.16.
model.getOutput(index)
3.3.17.
model.getTimer(timer)
3.3.18.
model.insertInput(input, line, value)
3.3.19.
model.insertMix(channel, line, value)
3.3.20.
model.resetTimer(timer)
3.3.21.
model.setCustomFunction(function, value)
3.3.22.
model.setGlobalVariable(index, phase, value)
3.3.23.
model.setInfo(value)
3.3.24.
model.setLogicalSwitch(switch, value)
3.3.25.
model.setModule(index, value)
3.3.26.
model.setOutput(index, value)
3.3.27.
model.setTimer(timer, value)
3.4.
Lcd Functions
3.4.1.
Lcd Functions Overview
3.4.2.
lcd.clear()
3.4.3.
lcd.drawChannel(x, y, source, flags)
3.4.4.
lcd.drawCombobox(x, y, w, list, idx [, flags])
3.4.5.
lcd.drawFilledRectangle(x, y, w, h [, flags])
3.4.6.
lcd.drawGauge(x, y, w, h, fill, maxfill)
3.4.7.
lcd.drawLine(x1, y1, x2, y2, pattern, flags)
3.4.8.
lcd.drawNumber(x, y, value [, flags])
3.4.9.
lcd.drawPixmap(x, y, name)
3.4.10.
lcd.drawPoint(x, y)
3.4.11.
lcd.drawRectangle(x, y, w, h [, flags])
3.4.12.
lcd.drawScreenTitle(title, page, pages)
3.4.13.
lcd.drawSource(x, y, source [, flags])
3.4.14.
lcd.drawSwitch(x, y, switch, flags)
3.4.15.
lcd.drawText(x, y, text [, flags])
3.4.16.
lcd.drawTimer(x, y, value [, flags])
3.4.17.
lcd.getLastPos()
3.4.18.
lcd.lock()
4.
Part IV - Converting OpenTX 2.0 Scripts
4.1.
General Issues
4.2.
Handling GPS Sensor data
4.3.
Handling Lipo Sensor Data
5.
Part V - Advanced Topics
5.1.
Lua data sharing across scripts
5.2.
Debugging techniques
Powered by
GitBook
OpenTX 2.1 Lua Reference Guide
General Functions