> 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/entities/c_baseentity/schemaaccessor_t.md).

# SchemaAccessor\_t

This type represents a special structure that references a certain field in the entity object.

{% hint style="info" %}
You can check the returned type by using `type()` function.
{% endhint %}

{% hint style="danger" %}
Do not ever store an instance of this type anywhere but in a scope of an event because entity might be removed.
{% endhint %}

## offset <a href="#get" id="get"></a>

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

Type: number

***

## Get﻿ <a href="#get" id="get"></a>

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

Returns the value.

**Arguments**

None.

**Returns**

| Type     | Description |
| -------- | ----------- |
| `<type>` | Value.      |

**Example**

```lua
local health = player.m_iHealth:Get();
```

***

## GetAs <a href="#get" id="get"></a>

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

Returns the value casted as another game class. Automatically dereferences pointers.&#x20;

**Arguments**

| Name     | Type     | Description            |
| -------- | -------- | ---------------------- |
| `module` | `string` | The name of the module |
| `class`  | `string` | The name of the class  |

**Returns**

| Type     | Description   |
| -------- | ------------- |
| `<type>` | Casted value. |

**Example**

```lua
local collision = player.m_pCollision:GetAs('client.dll', 'CCollisionProperty');
local mins = collision.m_vecMins:Get()
local maxs = collision.m_vecMaxs:Get()
```

***

## Set﻿ <a href="#set" id="set"></a>

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

Sets the value.

**Arguments**

| Name    | Type     | Description |
| ------- | -------- | ----------- |
| `value` | `<type>` | Value.      |

**Returns**

Nothing.

**Example**

```lua
player.m_iHealth:Set(50); -- won't really do anything with the health
```

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


---

# 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:

```
GET https://lua2.fatality.win/api/instances/entities/c_baseentity/schemaaccessor_t.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.
