Dataref.set() Method

The Dataref.set() sets the value of a dataref. The new value is provided to the dataref's owner, which may or may not change the value of this dataref.

Syntax

Dataref.set(new_value)

Parameters

Return value

This function has no return value.

Exceptions

Example

> dataref = simulator.findDataref("laminar/c172/fuel/fuel_tank_selector")
Dataref{ name: "laminar/c172/fuel/fuel_tank_selector" }
> dataref.set(1)
undefined
> dataref.set("banana")
Uncaught TypeError: Invalid value type
> dataref = simulator.findDataref("sim/version/xplane_internal_version")
Dataref{ name: "sim/version/xplane_internal_version" }
> dataref.set(121000)
Uncaught Error: Not writable

References