> For the complete documentation index, see [llms.txt](https://lua2.fatality.win/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://lua2.fatality.win/api/instances/ws.md).

# 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
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://lua2.fatality.win/api/instances/ws.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
