# model.getGlobalVariable(index, flight\_mode)

Return current global variable value

Example:

```lua
  -- get GV3 (index = 2) from Flight mode 0 (FM0)
  val = model.getGlobalVariable(2, 0)
```

## Parameters

* `index` zero based global variable index, use 0 for GV1, 8 for GV9
* `flight_mode` Flight mode number (0 = FM0, 8 = FM8)

## Return value

* `nil` requested global variable does not exist
* `number` current value of global variable

### Notice

a simple warning or notice


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://luadoc.edgetx.org/opentx_2.3/part_iii_-_opentx_lua_api_reference/model-functions-less-than-greater-than-luadoc-begin-model/getglobalvariable.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
