# UnitRole (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/UnitRole

## Functions

### AreClassRolesSoftSuggestions

```lua
result = AreClassRolesSoftSuggestions()
```

If true, UnitGetAvailableRoles results should be treated as suggested role, not hard limits on what role the current player can display as.

Returns:
- `result`: bool

### CanShowSetRoleButton

```lua
result = CanShowSetRoleButton()
```

Returns:
- `result`: bool

### InitiateRolePoll

```lua
result = InitiateRolePoll()
```

Returns:
- `result`: bool

### UnitGetAvailableRoles

```lua
tank, healer, dps = UnitGetAvailableRoles(unit)
```

May return nothing.

Its returns can be secret values (in some instances and fights): guard them before any arithmetic.

Arguments:
- `unit`: UnitToken

Returns:
- `tank`: bool
- `healer`: bool
- `dps`: bool

### UnitSetRole

```lua
result = UnitSetRole(unit, [roleStr])
```

Arguments:
- `unit`: UnitToken
- `roleStr`: cstring, may be nil

Returns:
- `result`: bool

### UnitSetRoleEnum

```lua
result = UnitSetRoleEnum(unit, [role])
```

Arguments:
- `unit`: UnitToken
- `role`: LFGRole, may be nil

Returns:
- `result`: bool

## Events

### ROLE_CHANGED_INFORM

Payload, after the event's name:
- `changedName`: cstring
- `fromName`: cstring
- `oldRole`: cstring
- `newRole`: cstring

### ROLE_POLL_BEGIN

Payload, after the event's name:
- `fromName`: 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."
