# Task List

## Exports

### Toggle UI

```lua
exports.ls_tasklist:toggleUI(state)
params:[
    state: 'boolean'
]

Only set the state to false if everything is done, because that resets everything.
```

### Toggle Number Of Tasks

```lua
exports.ls_tasklist:toggleNumberOfTask(state)
params:[
    state: 'boolean'
]
```

### Update Task Amount

```lua
exports.ls_tasklist:updateTaskAmount(taskAmount)
params:[
    taskAmount: 'number'
]

If you use bigger amount that the maximum amount the script is ignore it!
```

### Update Stage Amount

```lua
exports.ls_tasklist:updateStageAmount(index, currentStage)
params:[
    index: 'number',
    currentStage: 'number'
]

if you use bigger amount that the maximum amount the script is ignore it!
```

### Complete Task By Index

```lua
exports.ls_tasklist:setCompleteByIndex(index)
params:[
    index: 'number'
]

If the task is completed and run one more time, then set it to false. 
This works like a boolean value.
```

### Set Task Data

```lua
exports.ls_tasklist:setTaskData(data)
params: [
    data: table [
        title: 'string',
        maximumTask: 'number'
        currentTaskAmount: 'number',
        showNumberOfTask: 'boolean',
        dynamicBar: 'boolean',
        tasks : 'table' [
            index: 'number',
            icon: 'string',
            text: 'string',
            completed: 'boolean'
            currentStage: 'number',
            totalStage 'number',
        ]
    ]
]

Example:
exports.ls_tasklist:setTaskData(
{
        title = 'Example',
        maximumTask = 10,
        currentTaskAmount = 0,
        showNumberOfTask = true,
        dynamicBar = false,
        tasks = {
            { index = 1, icon = 'fa-solid fa-car', text = 'Example text', currentStage = 0, totalStage = 10 },
        }
    })

currentTaskAmount, showNumberOfTask, dynamicBar, currentStage not required.
Now every parameter have default value so you dont need to define it anymore.

Everything work same as before, but if the maximumTask or totalStage not setted,
then cant use the not required paramteres.
```

### Reset Tasks Completes

```lua
exports.ls_tasklist:resetCompletes()
```


---

# 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://los-santos-project.gitbook.io/project-los-santos-scripts/scripts/task-list.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.
