---
title: "readIndices(_:)"
framework: realitykit
role: symbol
role_heading: Instance Method
path: "realitykit/lowlevelmeshresource/readindices(_:)"
---

# readIndices(_:)

Reads the index buffer synchronously on the CPU. The buffer is only valid for the lifetime of the callback.

## Declaration

```swift
final func readIndices<R, E>(_ body: (RawSpan) throws(E) -> R) throws(E) -> R where E : Error, R : ~Copyable
```

## Parameters

- `body`: A closure that receives a read-only span over the index buffer’s bytes.

## Discussion

Discussion note: Any error thrown by body.

## See Also

### Accessing index data

- [updateIndices(_:)](realitykit/lowlevelmeshresource/updateindices(_:).md)
- [replaceIndices(_:)](realitykit/lowlevelmeshresource/replaceindices(_:).md)
- [readIndices(commandBuffer:)](realitykit/lowlevelmeshresource/readindices(commandbuffer:).md)
- [replaceIndices(commandBuffer:)](realitykit/lowlevelmeshresource/replaceindices(commandbuffer:).md)
