# Label

This type represents a label control.

{% hint style="info" %}
This type inherits [`Control`](/api/instances/gui/control.md) type. All of its base methods and fields are also available in this type.
{% endhint %}

## \_\_call﻿ <a href="#call" id="call"></a>

[<kbd><mark style="background-color:purple;">**Constructor**<mark style="background-color:purple;"></kbd>](#user-content-fn-1)[^1]

Constructs the label.

**Arguments**

| Name   | Type                                                           | Description                                    |
| ------ | -------------------------------------------------------------- | ---------------------------------------------- |
| `id`   | [`ControlID`](/api/instances/gui/types/controlid.md)`\|string` | Control ID.                                    |
| `str`  | `string`                                                       | Label string.                                  |
| `col`  | [`Color`](/api/instances/draw/types/color.md)                  | Label color. Defaults to `nil`.                |
| `bold` | `bool`                                                         | Whether to use bold font. Defaults to `false`. |

**Returns**

| Type    | Description   |
| ------- | ------------- |
| `Label` | Label object. |

**Example**

```lua
local lab = gui.Label(id, 'Hello!');
```

***

## text <a href="#call" id="call"></a>

[<kbd><mark style="background-color:purple;">**Field**<mark style="background-color:purple;"></kbd>](#user-content-fn-1)[^1]

Text for this label

***

### SetText <a href="#set-text" id="set-text"></a>

[<kbd><mark style="background-color:purple;">**Method**<mark style="background-color:purple;"></kbd>](#user-content-fn-2)[^2]

Sets the new text.

**Arguments**

| Name  | Type     | Description |
| ----- | -------- | ----------- |
| `str` | `string` | New text.   |

**Returns**

Nothing.

**Example**

```lua
lab:SetText('New hello!');
```

[^1]: This is a constructor definition for this type.

[^2]: This field is a method and must be invoked using a colon (:)


---

# 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://lua2.fatality.win/api/instances/gui/control/label.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.
