> For the complete documentation index, see [llms.txt](https://codeforge.gitbook.io/codeforge/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://codeforge.gitbook.io/codeforge/sleek-series/sleek-pause-menu/exports.md).

# Exports

**Pause Menu Exports Documentation**

The `forge-pausemenu` script includes exports designed to handle cases where the Pause Menu might unintentionally appear when pressing the `ESCAPE` key, especially while other user interfaces (UI) are active.

#### Why These Exports Are Needed

While the script uses `SEND NUI` communication from other scripts to detect if a UI is open and prevent the Pause Menu from appearing, there are situations where interfaces don't utilize this mechanism. In these cases, pressing `ESCAPE` can still bring up the Pause Menu unintentionally. To address this, `forge-pausemenu` provides the following exports for explicit control over the menu's behavior.

#### Exports Overview

* **`disableMenu`**\
  Forces the Pause Menu to be disabled, regardless of other conditions. This is useful to ensure the menu does not appear during interactions with UIs that don't trigger `SEND NUI`.

  ```lua
  exports['forge-pausemenu']:disableMenu()
  ```
* **`enableMenu`**\
  Re-enables the Pause Menu after being force-disabled, allowing it to function normally when no UI is active.

  ```lua
  exports['forge-pausemenu']:enableMenu()
  ```
* **`setMenuState(state)`**\
  Directly sets the state of the Pause Menu (`true` for enabled, `false` for disabled). This is a flexible way to control the menu based on your script's logic.

  * **Parameter:**
    * `state` *(boolean)*: The desired state of the Pause Menu.

  ```lua
  exports['forge-pausemenu']:setMenuState(false)
  ```
* **`getMenuState`**\
  Returns the current state of the Pause Menu, considering both the enabled/disabled state and any force-disable flag.

  * **Returns:**
    * *(boolean)*: `true` if the menu is enabled and not force-disabled, `false` otherwise.

  ```lua
  local isMenuActive = exports['forge-pausemenu']:getMenuState()
  ```
