> 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
