---
title: "debug.getcallstack"
description: "Returns metadata for call frames of the current or supplied thread."
---

```lua
debug.getcallstack(thread: thread?): {DebugInfo}
```

---

## Aliases

- `getcallstack`

---

## Arguments

<ParamField body="thread" type="thread">
  The coroutine whose environment, script association, or stack is inspected.
</ParamField>

---

## Returns

<ResponseField name="frames" type="{DebugInfo}">
  An array of DebugInfo records for the inspected thread's call frames.
</ResponseField>

Result entries include func plus source/name/line/parameter fields; metadata depends on compilation settings.

**Related types:** [Debug types & behavior](/reference/debug/types).

---

## Example

```lua
for _, frame in ipairs(debug.getcallstack()) do print(frame.name, frame.currentline) end
```
