[**SixL client API**](../../README.md)

***

[SixL client API](../../README.md) / [world-entities](../README.md) / TextLabelMpPool

# Interface: TextLabelMpPool

The pool of text labels: `mp.labels`. It holds the labels the server has sent to this client, and the ones a script made.

## Example

```ts
mp.labels.forEach((label) => mp.console.logInfo(label.text));
```

## Constructors

### Constructor

> **new TextLabelMpPool**(`text`, `position`, `options?`): [`TextLabelMp`](TextLabelMp.md)

Makes a text label, drawn by the overlay until it is destroyed.

#### Parameters

##### text

`string`

The text.

##### position

[`Vector3`](../../common/interfaces/Vector3.md)

Where it floats, metres.

##### options?

`color` (`[r, g, b, a]`, white by default), `drawDistance` (metres, 20 by default), `font`,
`los` (false by default) and `dimension`.

###### color?

[`Array4d`](../../common/type-aliases/Array4d.md)

###### dimension?

`number`

###### drawDistance?

`number`

###### font?

`number`

###### los?

`boolean`

#### Returns

[`TextLabelMp`](TextLabelMp.md)

The new label.

#### Remarks

It is not streamed: no stream-in event is raised for it.

#### Example

```ts
const label = mp.labels.new('Shop', new mp.Vector3(10, 20, 32), { drawDistance: 30 });
```

## Properties

### length

> `readonly` **length**: `number`

The number of labels the client holds now.

#### Example

```ts
const count = mp.labels.length;
```

## Methods

### at()

> **at**(`id`): [`TextLabelMp`](TextLabelMp.md)

The label with this client id, or `undefined`.

#### Parameters

##### id

`number`

The client's own number for the label (from 1, reused after a label is removed). It is not the server's id.

#### Returns

[`TextLabelMp`](TextLabelMp.md)

The label, or `undefined` when there is none with that id.

#### Example

```ts
const label = mp.labels.at(1);
```

***

### exists()

> **exists**(`entity`): `boolean`

Whether a label is still held by this client.

#### Parameters

##### entity

`number` \| [`TextLabelMp`](TextLabelMp.md)

A label, or the client id of one (the id of [TextLabelMpPool.at](#at)).

#### Returns

`boolean`

True while the label is held; false once the server has removed it from this client, or a script has destroyed it.

#### Example

```ts
if (mp.labels.exists(label)) { }
```

***

### forEach()

> **forEach**(`callingFunction`): `void`

Calls a function for every label held by this client.

#### Parameters

##### callingFunction

(`entity`) => `void`

Called with each label.

#### Returns

`void`

#### Example

```ts
mp.labels.forEach((label) => mp.console.logInfo(label.text));
```

***

### toArray()

> **toArray**(): [`TextLabelMp`](TextLabelMp.md)[]

The labels held by this client, as an array.

#### Returns

[`TextLabelMp`](TextLabelMp.md)[]

A new array of the labels at the time of the call.

#### Example

```ts
const all = mp.labels.toArray();
```
