# Console (global functions): World of Warcraft Forever API

Forever 1.60.1 (70959), Interface 16001, Lua 5.1, from Blizzard's own API documentation. Page: https://wowaddons.gg/forever-api/Console

## Functions

### CalculateStringEditDistance

```lua
distance = CalculateStringEditDistance(firstString, secondString)
```

Arguments:
- `firstString`: stringView
- `secondString`: stringView

Returns:
- `distance`: number

### ConsoleEcho

```lua
result = ConsoleEcho(command, [addToHistory], [prefix])
```

Arguments:
- `command`: cstring
- `addToHistory`: bool, default false
- `prefix`: cstring, may be nil

Returns:
- `result`: bool

### ConsoleExec

```lua
result = ConsoleExec(command, [addToHistory])
```

Arguments:
- `command`: cstring
- `addToHistory`: bool, default false

Returns:
- `result`: bool

### ConsoleGetAllCommands

```lua
commands = ConsoleGetAllCommands()
```

Returns:
- `commands`: ConsoleCommandInfo[]

### ConsoleGetColorFromType

```lua
color = ConsoleGetColorFromType(colorType)
```

Arguments:
- `colorType`: ConsoleColorType

Returns:
- `color`: colorRGB

### ConsoleGetFontHeight

```lua
fontHeightInPixels = ConsoleGetFontHeight()
```

Returns:
- `fontHeightInPixels`: number

### ConsoleIsActive

```lua
consoleIsActive = ConsoleIsActive()
```

Returns:
- `consoleIsActive`: bool

### ConsolePrintAllMatchingCommands

```lua
ConsolePrintAllMatchingCommands(partialCommandText)
```

Arguments:
- `partialCommandText`: cstring

### ConsoleSetFontHeight

```lua
ConsoleSetFontHeight(fontHeightInPixels)
```

Arguments:
- `fontHeightInPixels`: number

### SetConsoleKey

```lua
SetConsoleKey(keystring)
```

Arguments:
- `keystring`: cstring

## Events

### CONSOLE_CLEAR

No payload.

### CONSOLE_COLORS_CHANGED

No payload.

### CONSOLE_FONT_SIZE_CHANGED

No payload.

### CONSOLE_LOG

Payload, after the event's name:
- `message`: cstring

### CONSOLE_MESSAGE

Payload, after the event's name:
- `message`: cstring
- `colorType`: number

### CVAR_UPDATE

Payload, after the event's name:
- `eventName`: cstring
- `value`: cstring

### TOGGLE_CONSOLE

Payload, after the event's name:
- `showConsole`: bool, may be nil

## Tables

### Enum.ConsoleCategory (enumeration)

- `Debug` = 0
- `Graphics` = 1
- `Console` = 2
- `Combat` = 3
- `Game` = 4
- `Default` = 5
- `Net` = 6
- `Sound` = 7
- `Gm` = 8
- `Reveal` = 9
- `None` = 10

### Enum.ConsoleColorType (enumeration)

- `DefaultColor` = 0
- `InputColor` = 1
- `EchoColor` = 2
- `ErrorColor` = 3
- `WarningColor` = 4
- `GlobalColor` = 5
- `AdminColor` = 6
- `HighlightColor` = 7
- `BackgroundColor` = 8
- `ClickbufferColor` = 9
- `PrivateColor` = 10
- `DefaultGreen` = 11

### Enum.ConsoleCommandType (enumeration)

- `Cvar` = 0
- `Command` = 1
- `Macro` = 2
- `Script` = 3

### ConsoleCommandInfo (structure)

- `command`: cstring
- `help`: cstring
- `category`: ConsoleCategory
- `commandType`: ConsoleCommandType
- `scriptContents`: cstring
- `scriptParameters`: cstring

---
Make an addon with your AI: tell it "Read https://wowaddons.gg/agents.md, then make me a World of Warcraft Forever addon that …, try it with me in the game, and publish it."
