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

# makereadonly

Locks a table so its contents can't be changed.

```luau theme={null}
makereadonly(t: table): ()
```

## Parameters

| Parameter | Type    | Description        |
| --------- | ------- | ------------------ |
| `t`       | `table` | The table to lock. |

## Returns

<code title="the function does not return a value.">void</code>

## Example

<CodeGroup>
  ```luau Example 1 theme={null}
  <<<<<<< HEAD
  makereadonly(getrawmetatable(game))
  =======
  -- makereadonly(t: table): ()
  >>>>>>> 50e30f53759b0538759af25c9b271514aa2c9290
  ```

  ```luau Example 2 theme={null}
  local cfg = {speed = 16}

  makereadonly(cfg)
  cfg.speed = 100 --> errors: attempt to modify a readonly table
  ```
</CodeGroup>

<Tip>
  Always lock metatables back to read-only after editing them to avoid detection.
</Tip>
