# getSwitchIndex(positionName)

@status current Introduced in 2.6

## Parameters

* `positionName`: string naming a switch position as it is shown on radio menus where you can select a switch. Notice that many names have special characters in them like arrow up/down etc. (see [Special Character Constants](/edgetx-v2.8/part_iii_-_opentx_lua_api_reference/constants/special-character-constants.md)).

## Return value

* value: integer. The switchIndex, which can be used as input for \`getSwitchName(switchIndex)\` and \`getSwitchValue(switchIndex)\`. Also corresponds to the fields in the table returned by \`model.getLogicalSwitch(switch)\` identifying switches.


---

# 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/edgetx-v2.8/part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/getswitchindex-positionname.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.
