VR-Forces 5.2 Lua Function Documentation

airportDataUtils

(For high level concepts about how to use Lua to write scripted tasks, please see VR-Forces User's Guide.)

Functions that compute information of interest about airports and runways. Several functions take aerodromes as an argument. You can retrieve these aerodromes as, e.g.

 aerodromes = vrf:getAerodromeWithinRange(myDepartureFlightPlan[1]["location"], 10000) 

To use these functions, the script must use the require command and refer to the module:
local ap = require "airportDataUtils"
runwayRoute = ap.findSuitableRunway(...

Function List

findAirportInfo (location, aerodromes, minLength) Finds the code (ICAO) and elevation of the closest airport to the specified location.
findClosestSuitableAerodromeAndRunway (location, aerodromes, minLength, isDeparture) Returns an aerodrome and a runway name at that aerodrome that is closest to the location
findSuitableAerodromeAndRunway (location, aerodromes, desiredHeading, minLength, isDeparture) Returns an aerodrome and a runway name at that aerodrome that is closest to the location and suitable to use
runwayEndpoints (aerodrome, runway, airportElevation) Returns the start and end of a runway, based on the aerodrome aerodrome is an aerodrome that contains the specified runway airport elevation is the altitude at which to set the endpoints.


Functions

findAirportInfo (location, aerodromes, minLength)
Finds the code (ICAO) and elevation of the closest airport to the specified location. Requires a list of potential aerodromes

Parameters:

  • location: (Location3D) Specified test location.
  • aerodromes: (table) A list of AerodromeObjects.
  • minLength: (table) -1 for closest aerodrome or a value for closest aerodrome with a minimum runway length.

Return value:

    code, elevation (two values)
findClosestSuitableAerodromeAndRunway (location, aerodromes, minLength, isDeparture)
Returns an aerodrome and a runway name at that aerodrome that is closest to the location

Parameters:

  • location: Location3D -- Finds the airport closest to the location.
  • aerodromes: (table) is a list of potential AerodromeObjects to check
  • minLength: is the minimum length runway to accept.
  • isDeparture: is a boolean to indicate whether this is an arrival or departure.

Return value:

    simObject that is the runway. It is a route with two points.
findSuitableAerodromeAndRunway (location, aerodromes, desiredHeading, minLength, isDeparture)
Returns an aerodrome and a runway name at that aerodrome that is closest to the location and suitable to use

Parameters:

  • location: Location3D -- Finds the airport closest to the location.
  • aerodromes: (table) is a list of potential AerodromeObjects to check
  • desiredHeading: is the desired heading of the runway. A runway at the airport near location will be selected. -- to best match this heading. In radians.
  • minLength: is the minimum length runway to accept.
  • isDeparture: is a boolean to indicate whether this is an arrival or departure.

Return value:

    simObject that is the runway. It is a route with two points.
runwayEndpoints (aerodrome, runway, airportElevation)
Returns the start and end of a runway, based on the aerodrome aerodrome is an aerodrome that contains the specified runway airport elevation is the altitude at which to set the endpoints.

Parameters:

  • aerodrome: (AerodromeObject)
  • runway: (string)
  • airportElevation: (number) An elevation in meters.

Return value:

    a table of two Location3D.

Copyright© 2025 MAK Technologies, Inc. All rights reserved.