# Exports

## IsSitting

Returns if the local player is sitting.

```lua
exports.sit:IsSitting()
```

**Example**

```lua
---@return boolean isSitting
local isSitting = exports.sit:IsSitting()
print("isSitting:", isSitting)
```

## IsLaying

Returns if the local player is laying down.

```lua
exports.sit:IsLaying()
```

**Example**

```lua
---@return boolean isLaying
local isLaying = exports.sit:IsLaying()
print("isLaying:", isLaying)
```

## IsSittingOrLaying

Returns if the local player is sitting or laying.

```lua
exports.sit:IsSittingOrLaying()
```

**Example**

```lua
---@return boolean isSittingOrLaying
local isSittingOrLaying = exports.sit:IsSittingOrLaying()
print("isSittingOrLaying:", isSittingOrLaying)
```

## IsNearSeat

Returns if the local player is closer than Config.MaxInteractionDist to a seat.

```lua
exports.sit:IsNearSeat()
```

**Example**

```lua
---@return boolean isNearSeat
local isNearSeat = exports.sit:IsNearSeat()
print("isNearSeat:", isNearSeat)
```

## IsNearBed

Returns if the local player is closer than Config.MaxInteractionDist to a bed.

```lua
exports.sit:IsNearBed()
```

**Example**

```lua
---@return boolean isNearBed
local isNearBed = exports.sit:IsNearBed()
print("isNearBed:", isNearBed)
```

## GetClosestSeat

Returns the closest seat to the player.

```lua
exports.sit:GetClosestSeat()
```

**Example**

```lua
---@return boolean found if any position was found or not
---@return table closest table containing the data about the closest seat
local found, closest = exports.sit:GetClosestSeat()
if found then
    -- print(json.encode(closest, {indent=true}))
    print("type:", closest.type) -- "sit"
    print("entity:", closest.entity) -- number (0 if poly)
    print("coords:", closest.coords) -- coords, vector3
    print("distance:", closest.distance) -- distance, number
    print("name:", closest.name) -- Poly name (if applicable)
    print("group:", closest.group) -- Poly group
else
    print("No seat was found!")
end
```

## GetClosestBed

Returns the closest bed to the player.

```lua
exports.sit:GetClosestBed()
```

**Example**

```lua
---@return boolean found if any position was found or not
---@return table closest table containing the data about the closest bed
local found, closest = exports.sit:GetClosestBed()
if found then
    -- print(json.encode(closest, {indent=true}))
    print("type:", closest.type) -- "sit"
    print("entity:", closest.entity) -- number (0 if poly)
    print("coords:", closest.coords) -- coords, vector3
    print("distance:", closest.distance) -- distance, number
    print("name:", closest.name) -- Poly name (if applicable)
    print("group:", closest.group) -- Poly group
else
    print("No seat was found!")
end
```

## SitOnClosestSeat

Makes the local player sit on the closest seat.

```lua
exports.sit:SitOnClosestSeat()
```

## LayOnClosestBed

Makes the local player lay down on the closest bed.

```lua
exports.sit:LayOnClosestBed()
```

## StopCurrentAction

Makes the local player get up if they are sitting or laying down.

```lua
exports.sit:StopCurrentAction()
```

**Example**

```lua
if exports.sit:IsSitting() or exports.sit:IsLaying() then
    exports.sit:StopCurrentAction()
end
```

## DisableSitting

Disables sitting. If `reason` isn't specified it will be handled as 'default' internally.

```lua
exports.sit:DisableSitting(state, reason)
```

**Example**

<pre class="language-lua"><code class="lang-lua">---@param boolean state
---@param string reason
<strong>exports.sit:DisableSitting(true, 'dead')
</strong></code></pre>

## DisableLaying

Disables laying. If `reason` isn't specified it will be handled as 'default' internally.

```lua
exports.sit:DisableLaying(state, reason)
```

**Example**

```lua
---@param boolean state
---@param string reason
exports.sit:DisableLaying(true, 'dead')
```

## DisableSittingAndLaying

Disables sitting and laying. If `reason` isn't specified it will be handled as 'default' internally.

```lua
exports.sit:DisableSittingAndLaying(state, reason)
```

**Example**

```lua
---@param boolean state
---@param string reason
exports.sit:DisableSittingAndLaying(true, 'dead')
```

## IsSittingDisabled

Returns if sitting is disabled as the first return value, and the reason (if applicable) as the second value.

```lua
exports.sit:IsSittingDisabled()
```

**Example**

```lua
---@return boolean isDisabled
---@return table reasons
local isDisabled, reasons = exports.sit:IsSittingDisabled()
print(isDisabled, json.encode(reasons, {indent=true}))
```

## IsLayingDisabled

Returns if laying is disabled as the first return value, and the reason (if applicable) as the second value.

```lua
exports.sit:IsLayingDisabled()
```

**Example**

```lua
---@return boolean isDisabled
---@return table reasons
local isDisabled, reasons = exports.sit:IsLayingDisabled()
print(isDisabled, json.encode(reasons, {indent=true}))
```

## GetSitDisableReasons

Returns the reasons that sitting is disabled, returns an empty table if there are no reasons.

```lua
exports.sit:GetSitDisableReasons()
```

**Example**

```lua
---@return table reasons
local reasons = exports.sit:GetSitDisableReasons()
print(json.encode(reasons, {indent = true}))
```

## GetLayDisableReasons

Returns the reasons that laying is disabled, returns an empty table if there are no reasons.

```lua
exports.sit:GetLayDisableReasons()
```

**Example**

```lua
---@return table reasons
local reasons = exports.sit:GetLayDisableReasons()
print(json.encode(reasons, {indent = true}))
```


---

# 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://madsl.gitbook.io/docs/resources/sit-anywhere/exports.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.
