Skip to content

Source:value

since 1.1.0

Return the source value / Set the source value on Lua sources / Vars / Telemetry sensors.

local value = source:value([options])

Parameters

Name Type Required Description
options table / number optional

Returns

value (nil / integer / number / string)

Examples

From the official Ethos documentation
source = system.getSource({name="GPS", options=OPTION_LATITUDE})
print(source:value())
More from the official documentation
source = system.getSource("LiPo", options=OPTION_CELLS_COUNT)
print(source:value())
source = system.getSource("LiPo")
print(source:value({options=OPTION_CELLS_COUNT}))
print(source:value({options=OPTION_CELL_INDEX(1)}))
More from the official documentation
source = system.getSource({category=CATEGORY_CHANNEL, member=0})
print(source:value({options=OPTION_CHANNEL_OUTPUT+OPTION_CHANNEL_PWM}))
More from the official documentation
source = system.getSource("MySensor")
print(source:value()) -- get the value of MySensor