---
title: "debug.getprotos"
description: "Lists nested prototypes in a Lua function."
---

```lua
debug.getprotos(target: function | number, active: boolean? = false): {any}
```

---

## Aliases

- `getprotos`

---

## Arguments

<ParamField body="target" type="function | number" required>
  The function to inspect, or a positive stack level identifying a caller.
</ParamField>

<ParamField body="active" type="boolean" default={"false"}>
  Select the active prototype mode. The behavior differs between getproto and getprotos.
</ParamField>

---

## Returns

<ResponseField name="prototypes" type="{any}">
  A 1-based prototype list: lightuserdata by default, constructed closures in active mode.
</ResponseField>

false returns lightuserdata prototype pointers, not callable functions. true constructs new Lua closures; unlike getproto(true), it does not search for existing live closures. Captured values may be uninitialized.

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

---

## Example

```lua
local function outer() return function() return "nested" end end
for index, proto in pairs(debug.getprotos(outer)) do print(index, typeof(proto)) end
```
