> Agent-readable docs index: /llms.txt. Download /docs.zip to grep all markdown files locally.

---
title: Table Clearing
icon: eraser
sidebar_position: 6
---

# <ApiPageIcon icon="eraser" />Table Clearing

## Functions<ApiTag label="global functions" />

<ApiMembers>
  <ApiMember kind="fn" name="table.clear" summary="An extra library function `table.clear()` can be made available via `require(&#x22;table.clear&#x22;)`. This clears all keys and values from a table, but preserves the allocated array/hash sizes. Existing references still point to the cleared table, allowing its storage to be reused." args="tab" sig="[{&#x22;s&#x22;:&#x22;table.clear&#x22;},{&#x22;s&#x22;:&#x22;(&#x22;},{&#x22;s&#x22;:&#x22;tab&#x22;},{&#x22;s&#x22;:&#x22;: &#x22;},{&#x22;s&#x22;:&#x22;table&#x22;,&#x22;k&#x22;:&#x22;prim&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/lua/table#table-1&#x22;},{&#x22;s&#x22;:&#x22;)&#x22;}]" params="[{&#x22;n&#x22;:&#x22;tab&#x22;,&#x22;t&#x22;:[{&#x22;s&#x22;:&#x22;table&#x22;,&#x22;k&#x22;:&#x22;prim&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/lua/table#table-1&#x22;}],&#x22;d&#x22;:&#x22;Table to clear&#x22;}]" />
</ApiMembers>
