> ## Documentation Index
> Fetch the complete documentation index at: https://gluals.arnux.net/llms.txt
> Use this file to discover all available pages before exploring further.

# @builtin_alias

> Keep a Lua built-in's special handling on a declaration that replaces it.

> [!NOTE]
>
> This annotation is intended for complex cases and is primarily designed to be used by the built-in annotations.

## Overview

GLuaLS handles some Lua built-ins, such as `pairs`, specially. For example, it follows the keys a `pairs` loop visits.

Annotation files redeclare those built-ins to add Garry's Mod details. `builtin_alias` names the built-in a declaration stands for, so the special handling carries over.

***

## Syntax

```lua theme={null}
---@[builtin_alias("name")]
```

Put it after the `@return` line.

***

## Example

```lua theme={null}
---@generic K, V
---@param t table<K, V>
---@return fun(tbl: table<K, V>, index: K?): K, V
---@[builtin_alias("pairs")]
function _G.pairs(t) end
```

If your own code declares a global `pairs`, that declaration wins and the special handling stops.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.