# ws

Usage:

`ws.{function}`

This table exposes Workshop utilities.

***

## GetItemID

&#x20;<kbd><mark style="color:blue;">**Function**<mark style="color:blue;"></kbd>&#x20;

Returns current Item ID. Local scripts always return 0.

**Arguments**

None.

**Returns**

| Type     | Description |
| -------- | ----------- |
| `number` | Item ID.    |

**Example**

```lua
local item_id = ws.GetItemID();
```

***

## GetBuildID

<kbd><mark style="color:blue;">**Function**<mark style="color:blue;"></kbd>

Returns current Build ID. Local scripts always return 0.

**Arguments**

None.

**Returns**

| Type     | Description |
| -------- | ----------- |
| `number` | Build ID.   |

**Example**

```lua
local build_id = ws.GetBuildID();
```

***

## GetTitle

<kbd><mark style="color:blue;">**Function**<mark style="color:blue;"></kbd>

Returns current script title.

**Arguments**

None.

**Returns**

| Type     | Description |
| -------- | ----------- |
| `string` | Title.      |

**Example**

```lua
local title = ws.GetTitle();
```

***

## TestCapability

<kbd><mark style="color:blue;">**Function**<mark style="color:blue;"></kbd>

Returns whether current script has a capability enabled. Available capabilities: `ffi`, `clipboard`, `fs`, `http`

**Arguments**

| Name  | Type     | Description    |
| ----- | -------- | -------------- |
| `cpb` | `string` | Capability ID. |

**Returns**

| Type   | Description                                 |
| ------ | ------------------------------------------- |
| `bool` | True if script has the provided capability. |

**Example**

```lua
if ws.TestCapability('clipboard') then
    utils.ClipboardSet('Hello!');
end
```

***

## GetResourceDir

<kbd><mark style="color:blue;">**Function**<mark style="color:blue;"></kbd>

Returns resource directory for this script. It is recommended to use this function only for Workshop scripts, as that is where your resources will be unpacked to.

**Arguments**

None.

**Returns**

| Type     | Description                                            |
| -------- | ------------------------------------------------------ |
| `string` | Resource directory. Example: `fatality/resource/12345` |

**Example**

```lua
local resource_dir = ws.GetResourceDir();
local tex = draw.Texture(resource_dir .. '/my_texture.png');
```


---

# 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/ws.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.
