XPLMNavigation
Query the X-Plane navigation database (airports, VORs, NDBs, fixes, etc.) and program the FMS/GPS flight plan.
Enumerations
Functions
XLuaCountFMSEntries()
Returns: integer
This routine returns the number of entries in the FMS.
XLuaGetDisplayedFMSEntry()
Returns: integer
This routine returns the index of the entry the pilot is viewing.
XLuaGetDestinationFMSEntry()
Returns: integer
This routine returns the index of the entry the FMS is flying to.
XLuaSetDisplayedFMSEntry(index)
Returns: (returns nothing)
This routine changes which entry the FMS is showing to the index specified.
| Argument | Type | Notes |
|---|---|---|
index |
integer |
XLuaSetDestinationFMSEntry(index)
Returns: (returns nothing)
This routine changes which entry the FMS is flying the aircraft toward. The track is from the n-1'th point to the n'th point.
| Argument | Type | Notes |
|---|---|---|
index |
integer |
XLuaGetFMSEntryInfo(index)
Returns: {k} with keys: type, iD, ref, altitude, lat, lon
This routine returns information about a given FMS entry. If the entry is an airport or navaid, a reference to a nav entry can be returned allowing you to find additional information (such as a frequency, ILS heading, name, etc.). Note that this reference can be XPLM_NAV_NOT_FOUND until the information has been looked up asynchronously, so after flightplan changes, it might take up to a second for this field to become populated. The other information is available immediately. For a lat/lon entry, the lat/lon is returned by this routine but the navaid cannot be looked up (and the reference will be XPLM_NAV_NOT_FOUND). FMS name entry buffers should be at least 256 chars in length. WARNING: Due to a bug in X-Plane prior to 11.31, the navaid reference will not be set to XPLM_NAV_NOT_FOUND while no data is available, and instead just remain the value of the variable that you passed the pointer to. Therefore, always initialize the variable to XPLM_NAV_NOT_FOUND before passing the pointer to this function.
| Argument | Type | Notes |
|---|---|---|
index |
integer |
Output table keys:
| Key | Type |
|---|---|
type |
number |
iD |
{ i } |
ref |
XPLMNavRef |
altitude |
number |
lat |
number |
lon |
number |
XLuaSetFMSEntryInfo(index, ref, altitudeFt)
Returns: (returns nothing)
This routine changes an entry in the FMS to have the destination navaid passed in and the altitude specified. Use this only for airports, fixes, and radio-beacon navaids. Currently of radio beacons, the FMS can only support VORs and NDBs. Use the routines below to clear or fly to a lat/lon.
| Argument | Type | Notes |
|---|---|---|
index |
integer |
|
ref |
XPLMNavRef |
Enum — use a constant from XPLMNavRef |
altitudeFt |
integer |
XLuaSetFMSEntryLatLon(index, lat, lon, altitudeFt)
Returns: (returns nothing)
This routine changes the entry in the FMS to a lat/lon entry with the given coordinates.
| Argument | Type | Notes |
|---|---|---|
index |
integer |
|
lat |
number |
|
lon |
number |
|
altitudeFt |
integer |
XLuaClearFMSEntry(index)
Returns: (returns nothing)
This routine clears the given entry, potentially shortening the flight plan.
| Argument | Type | Notes |
|---|---|---|
index |
integer |
XLuaCountFMSFlightPlanEntries(flightPlan)
Returns: integer
This routine returns the number of entries in the FMS.
| Argument | Type | Notes |
|---|---|---|
flightPlan |
XPLMNavFlightPlan |
Enum — use a constant from XPLMNavFlightPlan |
XLuaGetDisplayedFMSFlightPlanEntry(flightPlan)
Returns: integer
This routine returns the index of the entry the pilot is viewing.
| Argument | Type | Notes |
|---|---|---|
flightPlan |
XPLMNavFlightPlan |
Enum — use a constant from XPLMNavFlightPlan |
XLuaGetDestinationFMSFlightPlanEntry(flightPlan)
Returns: integer
This routine returns the index of the entry the FMS is flying to.
| Argument | Type | Notes |
|---|---|---|
flightPlan |
XPLMNavFlightPlan |
Enum — use a constant from XPLMNavFlightPlan |
XLuaSetDisplayedFMSFlightPlanEntry(flightPlan, index)
Returns: (returns nothing)
This routine changes which entry the FMS is showing to the index specified.
| Argument | Type | Notes |
|---|---|---|
flightPlan |
XPLMNavFlightPlan |
Enum — use a constant from XPLMNavFlightPlan |
index |
integer |
XLuaSetDestinationFMSFlightPlanEntry(flightPlan, index)
Returns: (returns nothing)
This routine changes which entry the FMS is flying the aircraft toward. The track is from the n-1'th point to the n'th point.
| Argument | Type | Notes |
|---|---|---|
flightPlan |
XPLMNavFlightPlan |
Enum — use a constant from XPLMNavFlightPlan |
index |
integer |
XLuaSetDirectToFMSFlightPlanEntry(flightPlan, index)
Returns: (returns nothing)
This routine changes which entry the FMS is flying the aircraft toward. The track is from the current position of the aircraft directly to the n'th point, ignoring the point before it.
| Argument | Type | Notes |
|---|---|---|
flightPlan |
XPLMNavFlightPlan |
Enum — use a constant from XPLMNavFlightPlan |
index |
integer |
XLuaGetFMSFlightPlanEntryInfo(flightPlan, index)
Returns: {k} with keys: type, iD, ref, altitude, lat, lon
This routine returns information about a given FMS entry. If the entry is an airport or navaid, a reference to a nav entry can be returned allowing you to find additional information (such as a frequency, ILS heading, name, etc.). Note that this reference can be XPLM_NAV_NOT_FOUND until the information has been looked up asynchronously, so after flightplan changes, it might take up to a second for this field to become populated. The other information is available immediately. For a lat/lon entry, the lat/lon is returned by this routine but the navaid cannot be looked up (and the reference will be XPLM_NAV_NOT_FOUND). FMS name entry buffers should be at least 256 chars in length. WARNING: Due to a bug in X-Plane prior to 11.31, the navaid reference will not be set to XPLM_NAV_NOT_FOUND while no data is available, and instead just remain the value of the variable that you passed the pointer to. Therefore, always initialize the variable to XPLM_NAV_NOT_FOUND before passing the pointer to this function.
| Argument | Type | Notes |
|---|---|---|
flightPlan |
XPLMNavFlightPlan |
Enum — use a constant from XPLMNavFlightPlan |
index |
integer |
Output table keys:
| Key | Type |
|---|---|
type |
number |
iD |
{ i } |
ref |
XPLMNavRef |
altitude |
number |
lat |
number |
lon |
number |
XLuaSetFMSFlightPlanEntryInfo(flightPlan, index, ref, altitudeFt)
Returns: (returns nothing)
This routine changes an entry in the FMS to have the destination navaid passed in and the altitude specified. Use this only for airports, fixes, and radio-beacon navaids. Currently of radio beacons, the FMS can only support VORs, NDBs and TACANs. Use the routines below to clear or fly to a lat/lon.
| Argument | Type | Notes |
|---|---|---|
flightPlan |
XPLMNavFlightPlan |
Enum — use a constant from XPLMNavFlightPlan |
index |
integer |
|
ref |
XPLMNavRef |
Enum — use a constant from XPLMNavRef |
altitudeFt |
integer |
XLuaSetFMSFlightPlanEntryLatLon(flightPlan, index, lat, lon, altitudeFt)
Returns: (returns nothing)
This routine changes the entry in the FMS to a lat/lon entry with the given coordinates.
| Argument | Type | Notes |
|---|---|---|
flightPlan |
XPLMNavFlightPlan |
Enum — use a constant from XPLMNavFlightPlan |
index |
integer |
|
lat |
number |
|
lon |
number |
|
altitudeFt |
integer |
XLuaSetFMSFlightPlanEntryLatLonWithId(flightPlan, index, lat, lon, altitudeFt, id, idLength)
Returns: (returns nothing)
This routine changes the entry in the FMS to a lat/lon entry with the given coordinates. You can specify the display ID of the waypoint.
| Argument | Type | Notes |
|---|---|---|
flightPlan |
XPLMNavFlightPlan |
Enum — use a constant from XPLMNavFlightPlan |
index |
integer |
|
lat |
number |
|
lon |
number |
|
altitudeFt |
integer |
|
id |
string |
|
idLength |
integer |
XLuaClearFMSFlightPlanEntry(flightPlan, index)
Returns: (returns nothing)
This routine clears the given entry, potentially shortening the flight plan.
| Argument | Type | Notes |
|---|---|---|
flightPlan |
XPLMNavFlightPlan |
Enum — use a constant from XPLMNavFlightPlan |
index |
integer |
XLuaLoadFMSFlightPlan(device, buffer, bufferLen)
Returns: (returns nothing)
Loads an X-Plane 11 and later formatted flightplan from the buffer into the FMS or GPS, including instrument procedures. Use device index 0 for the pilot-side and device index 1 for the co-pilot side unit.
| Argument | Type | Notes |
|---|---|---|
device |
integer |
|
buffer |
string |
|
bufferLen |
integer |
XLuaGetGPSDestinationType()
Returns: integer
This routine returns the type of the currently selected GPS destination, one of fix, airport, VOR or NDB.
XLuaGetGPSDestination()
Returns: XPLMNavRef
This routine returns the current GPS destination.
Examples
Examples coming soon.