# UI Library

## How to use?

Using the library its quite simple but also quite different from usual, since you'll have to provide your script inside the source entry in the json, once Arceus X runs it, it will provide to your script the following parameters:

```lua
local library, env = ...
```

By simply getting these parameters you can now use the UI library and get access to the safe environment dedicated to your script. Since the System is designed to work on any exploit by using our Extensions Loader, it can also provide more parameters, however in this case it wont garant the safety of the given environment table, for more details about this, contact us.

## Methods

In the library you can find the following methods:

### Set Title

```lua
lib:SetTitle(title: string)
```

* Sets the title shown on the extension GUI

***

### Add Page

```lua
lib:AddPage(name: string, icon: string, index: number?): page
```

{% content-ref url="/pages/nujoMZkPbEUNpFuRbKN4" %}
[Page](/arceus-x/extensions/ui-library/page.md)
{% endcontent-ref %}

* Adds a page to the extension GUI, you can find the methods of page in the UI Pages section

***

### Select Page

```lua
lib:SelectPage(page: index|page)
```

* Selects the page from index or reference

***

### Remove page

```lua
lib:RemovePage(page: index|page)
```

* Removes the page from index or reference

***

### Get Pages

```lua
lib:GetPages(): {page}
```

* Get a list of all pages

***

### Get Page By Name

```lua
lib:GetPageByName(name: string): page
```

* Get a page by its name

***

### Set Enabled

<pre class="language-lua"><code class="lang-lua"><strong>lib:SetEnabled(status: boolean)
</strong></code></pre>

* Sets the GUI visible or not, you shouldn't really care about this one.


---

# 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://riky47s-organization.gitbook.io/arceus-x/extensions/ui-library.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.
