Skip to content

system.getSource

since 1.1.0

Return a Source.

local source = system.getSource(name)

Parameters

Name Type Required Description
name string / table yes Source name or table

Returns

source (Source)

Examples

From the official Ethos documentation
system.getSource("RSSI")
system.getSource({name="GPS", options=OPTION_LATITUDE})
system.getSource({name="VFR", module=0, band=0})
system.getSource(nil)
system.getSource(CATEGORY_NONE)
system.getSource(CATEGORY_ALWAYS_ON)
system.getSource({category=CATEGORY_TELEMETRY_SENSOR, appId=0x0F10})
system.getSource({category=CATEGORY_TELEMETRY_SENSOR, appIdStart=0x0F10, appIdEnd=0x0F1F})
system.getSource({category=CATEGORY_TELEMETRY_SENSOR, appId=0xF101, subId=0})
system.getSource({category=CATEGORY_TELEMETRY_SENSOR, crsfId=0x14, subIdStart=0, subIdEnd=1})
system.getSource({category=CATEGORY_TIMER, member=1, options=0})
system.getSource({category=CATEGORY_SYSTEM, member=MAIN_VOLTAGE})
system.getSource({category=CATEGORY_SYSTEM_EVENT, member=SYSTEM_EVENT_RSSI_LOW})
system.getSource({category=CATEGORY_FUNCTION_SWITCH, member=5})

Used in

Real-world usage

Called 104 times across 9 open-source Ethos Lua projects. A few short excerpts:
local source = system.getSource(query)

src/dashx/lib/sensors.lua:178

local already = system.getSource(sensorDef)

src/inav-dashboard/sensors/telemetry.lua:246

sportSource = system.getSource({appId = 0xF101})

src/gps-heading/widget_impl.lua:197