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

# getrawmetatable

Returns the raw metatable of `object`, even when `__metatable` is set.

```luau theme={null}
getrawmetatable(object: table | userdata): table?
```

If the `__metatable` metamethod is set, `getmetatable` returns that value instead of the actual metatable itself. `getrawmetatable` skips that lock, and returns the metatable directly.

Most commonly used to grab the `game`'s `__index` or `__namecall` metamethods so you're able to hook them.

## Parameters

| Parameter | Type                | Description                       |
| --------- | ------------------- | --------------------------------- |
| `object`  | `table \| userdata` | The table or userdata to inspect. |

## Returns

`table?` - the metatable of `object`, or `nil` if it has none. The returned table is the source's metatable - **not a copy**. Editing the metatable mutates the live source.

## Example

<CodeGroup>
  ```luau Example 1 theme={null}
  <<<<<<< HEAD
  local mt = getrawmetatable(game)
  =======
  -- getrawmetatable(object: table | userdata): table?
  >>>>>>> 50e30f53759b0538759af25c9b271514aa2c9290
  ```

  ```luau Example 2 theme={null}
  print(getmetatable(game)) --> "This metatable is locked!"
  print(getrawmetatable(game)) --> table: 0x... 
                               --- which is the actual metatable
  ```
</CodeGroup>

<Tip>
  Anticheats and antitampers set `__metatable` on their own tables to hide the real metatable from `getmetatable`. `getrawmetatable` reads past that lock, so you can still see and hook what they protect.
</Tip>
