> ## Documentation Index
> Fetch the complete documentation index at: https://docs.projectx.gg/llms.txt
> Use this file to discover all available pages before exploring further.

# Exports

> Available exports for the Tasks resource

## Server Exports

### CreateTasks

Creates a new task list and returns a unique task list ID. Duplicate task names are automatically grouped and tracked using counters.

```lua theme={null}
local uid = exports['projectx-tasks']:CreateTasks(title, tasks)
```

<ParamField path="title" type="string" required>
  Title shown in the task UI
</ParamField>

<ParamField path="tasks" type="table" required>
  List of task names (strings)
</ParamField>

**Returns**

* `uid` (string) - Unique task list identifier

**Examples**

```lua theme={null}
local uid = exports['projectx-tasks']:CreateTasks('Mission Tasks', { 'Hack Panel', 'Hack Panel', 'Escape Area' })
```

```lua theme={null}
local uid = exports['projectx-tasks']:CreateTasks('Heist Objectives', { 'Collect Supplies', 'Disable Security', 'Crack Vault', 'Escape' })
```

***

### DeleteTasks

Deletes a task list and force closes it for all viewers.

```lua theme={null}
exports['projectx-tasks']:DeleteTasks(uid)
```

<ParamField path="uid" type="string" required>
  Task list ID
</ParamField>

**Returns**

* `boolean` - true if deleted, false if not found

***

### OpenTasks

Opens a task list UI for a specific player and registers them as a viewer.

```lua theme={null}
exports['projectx-tasks']:OpenTasks(player, uid, position)
```

<ParamField path="player" type="number" required>
  Player server ID
</ParamField>

<ParamField path="uid" type="string" required>
  Task list ID
</ParamField>

<ParamField path="position" type="string" default="right">
  UI position (`"left"` or `"right"`)
</ParamField>

**Returns**

* `boolean` - true if opened successfully

**Example**

```lua theme={null}
exports['projectx-tasks']:OpenTasks(source, uid, 'left')
```

***

### CloseTasks

Closes a task list UI for a specific player and removes them from the viewer list.

```lua theme={null}
exports['projectx-tasks']:CloseTasks(player, uid)
```

<ParamField path="player" type="number" required>
  Player server ID
</ParamField>

<ParamField path="uid" type="string" required>
  Task list ID
</ParamField>

**Returns**

* `boolean` - true if closed successfully

***

### UpdateTask

Updates the state of a task. Supports multiple instances of the same task name and tracks progress automatically. When all tasks are completed or failed, the task list closes and is removed.

```lua theme={null}
exports['projectx-tasks']:UpdateTask(uid, taskName, state)
```

<ParamField path="uid" type="string" required>
  Task list ID
</ParamField>

<ParamField path="taskName" type="string" required>
  Task label
</ParamField>

<ParamField path="state" type="boolean" required>
  `true` = task completed, `false` = task failed
</ParamField>

**Returns**

* `boolean` - true if the update was successful

**Example**

```lua theme={null}
exports['projectx-tasks']:UpdateTask(uid, 'Hack Panel', true)
```

***

### GetStatus

Returns the current status of a specific task within a task list.

```lua theme={null}
local status = exports['projectx-tasks']:GetStatus(uid, taskName)
```

<ParamField path="uid" type="string" required>
  Task list ID
</ParamField>

<ParamField path="taskName" type="string" required>
  Task label
</ParamField>

**Returns**

* `table` or `nil`
  * `Done` (boolean)
  * `Failed` (boolean)
  * `DoneCount` (number)
  * `Count` (number)

***

### GetIsListCompleted

Checks whether a task list has already been fully completed and cleaned up.

```lua theme={null}
local completed = exports['projectx-tasks']:GetIsListCompleted(uid)
```

<ParamField path="uid" type="string" required>
  Task list ID
</ParamField>

**Returns**

* `boolean` or `nil`
