---
title: "zeros(): function in Runtime, TypeShade API reference"
description: "zeros, a function in Runtime. A storage array of length zeroed structs of cls, a class a shader module exports: one range of the region."
url: https://typeshade.dev/api/zeros/
language: en
---

# `zeros()`

Function in Runtime

A storage array of length zeroed structs of cls, a class a shader module exports: one range of the region.

`import { zeros } from 'typeshade/runtime'`

The signature, the description and the examples come from the compiler's own source at commit af54ddad5.

## Syntax

```ts
function zeros<T extends object>(cls: ResourceClass<T, 'set'>, length: number): Buffer<T>
```

## Parameters

**`cls` `ResourceClass<T, 'set'>`**

**`length` `number`**

how many elements, a whole number.

## Return value

`Buffer<T>`

the array, whose element `i` is set as `ps.at(i).pos.set(…)`.

## Exceptions

**`TypeError`**

`TypeError` for a value that is no class of a shader module, for an abstract class, for a struct with no storage layout, for a field named `set`, which the host’s editor refuses already with [`TS8079`](https://typeshade.dev/reference/errors/ts8079/) (Amendment A5, D3), and for a length that is not a whole number.

## Source

[`src/runtime/resource.ts`, line 1034](https://github.com/typeshade/typeshade/blob/af54ddad5/src/runtime/resource.ts#L1034), at commit af54ddad5
