Request callback

From Sim Innovations Wiki
Revision as of 15:30, 5 February 2019 by Admin (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Description

request_callback(callback_function)

request_callback is used to force a callback on a given data subscription (X-plane, FSX, FS2, IIC or external sources)

Info The callback will only be called when there is a connection with the given flight simulator or data source.

Return value

This function won't return any value.

Arguments

# Argument Type Description
1 function_callback String The callback function that should be updated

Example

-- This function will be called when new data is available from X-plane
  function new_altitude_callback(altitude)
    print("New altitude: " .. altitude)
  end

  -- subscribe X-plane datarefs on the AirBus
  xpl_dataref_subscribe("sim/cockpit2/gauges/indicators/altitude_ft_pilot", "FLOAT", new_altitude_callback)

  -- Force a callback. The 'new_altitude_callback' function will be called here with its current arguments.
  request_callback(new_altitude_callback)