> For the complete documentation index, see [llms.txt](https://raia-software-inc.gitbook.io/tacview-2-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://raia-software-inc.gitbook.io/tacview-2-documentation/api-reference/api-reference/text-and-formatting/format-altitude-for-export.md).

# FormatAltitudeForExport()

Formats an altitude for export to a text file.

Use this function when your add-on needs to save an altitude in a clean and stable textual form.

Unlike `FormatAltitude()`, this function is intended for data export, not end-user display.

## Syntax

```lua
altitudeText = FormatAltitudeForExport(altitude)
```

## Parameters

### altitude

Type: `number`

Altitude value, in meters.

## Return value

Type: `string`

Returns the altitude formatted in meters, with a resolution of `0.01` meters.

The returned string does not include a unit suffix.

## Remarks

`FormatAltitudeForExport()` is designed for text data that may be read back later.

It outputs altitude in meters, independently from the user's unit preferences. This makes exported data predictable and easier to parse.

Use this function for:

* telemetry export
* CSV files
* text files intended to be processed later
* saved add-on data
* values that should remain stable across user settings

Do not use this function for normal user interface output. For labels, logs, panels, and other human-facing text, use `FormatAltitude()` instead.

## Example

### Save an altitude value

```lua
local transform = GetObjectTransform(objectHandle)

if transform ~= nil then

	local altitudeText = FormatAltitudeForExport(transform.altitude)

	-- Write altitudeText to a text file or exported data stream.

end
```

## Example

### Export latitude, longitude, and altitude

```lua
local transform = GetObjectTransform(objectHandle)

if transform ~= nil then

	local line = FormatString(
		"{0},{1},{2}",
		FormatLongitudeForExport(transform.longitude),
		FormatLatitudeForExport(transform.latitude),
		FormatAltitudeForExport(transform.altitude))

	-- Write line to an export file.

end
```

## Requirements

Tacview 2.0.0 or later

## See also

* [FormatAltitude()](/tacview-2-documentation/api-reference/api-reference/text-and-formatting/format-altitude.md)
* [FormatString()](/tacview-2-documentation/api-reference/api-reference/text-and-formatting/format-string.md)
* [String Format Specifiers](/tacview-2-documentation/api-reference/api-reference/text-and-formatting/format-string-notation.md)
* [GetObjectTransform()](/tacview-2-documentation/api-reference/api-reference/object-data/get-object-transform.md)
