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

# debug.getregistry

Returns the Luau registry - the table the VM keeps its internal references and loaded libraries in.

```luau theme={null}
debug.getregistry(): table
```

The same table object comes back on every call. Its direct contents are the VM's live internal references (threads, functions, userdata) plus `_LOADED` - every library and module required this session. The threads sitting in here are what `getscriptfromthread` walks to map a thread back to its owning script.

## Returns

`table` - the live registry. The same object is returned on every call.

| Key           | What's in it                                                        |
| ------------- | ------------------------------------------------------------------- |
| `_LOADED`     | Every library and module required in this session.                  |
| Internal keys | Live VM references the engine holds - threads, functions, userdata. |

## Aliases

* `getreg`
* `getregistry`

## Example

In a Roblox game, list every library and module the Luau VM has loaded so far this session.

<CodeGroup>
  ```luau Example 1 theme={null}
  <<<<<<< HEAD
  local getregistry = debug.getregistry()
  =======
  -- debug.getregistry(): table
  >>>>>>> 50e30f53759b0538759af25c9b271514aa2c9290
  ```

  ```luau Example 2 theme={null}
  local registry = debug.getregistry()

  for key in pairs(registry._LOADED) do -- _LOADED is the require cache for this session
      print(key)
  end
  ```
</CodeGroup>

<Tip>
  Use caution when modifying registry values, as it can cause instability in the Lua VM.
</Tip>
