
# Chat & HUD

## `chat`

| Function | Goes to |
|----------|---------|
| `chat.say(text)` | The server, as a chat message |
| `chat.command(cmd)` | The server, as a command; the leading `/` is optional |
| `chat.print(t)` | Your chat only, as a [text component](text.md) or string |

`print(...)` is standard Lua print and shows up in chat with a `lua »` prefix. Use
`chat.print` for styled output without one.

```lua
chat.command("time set day")
chat.print(text.literal("ready"):color(0x55FF55))
```

Client commands typed with the client prefix are [`commands`](commands.md).

## `hud`

Titles and the actionbar take a [text component](text.md) or a plain string. Boss bars and
the tab list are server-pushed and readable through [`server`](server.md).

| Function | Does |
|----------|------|
| `hud.actionbar(t)` | Writes above the hotbar |
| `hud.title(t)`, `hud.subtitle(t)` | Full-screen title and the line under it |
| `hud.title_times(i, s, o)` | Fade-in, stay, fade-out in ticks; vanilla uses `10, 70, 20` |
| `hud.clear_title()` | Removes the current title now |
| `hud.notify(title[, subtext[, kind[, duration]]])` | Notification pill. `kind` is `"info"` (default), `"success"` or `"error"`; `duration` is in seconds |

```lua
hud.title_times(5, 40, 10)
hud.subtitle("prepare yourself")
hud.title(text.literal("Round 2"):bold(true))
hud.notify("Saved", nil, "success")
```
