---
title: "debug.setinfo"
description: "Updates selected function/frame metadata."
---

```lua
debug.setinfo(target: function | number, field: string, value: any): ()
```

---

## Aliases

- `setinfo`

---

## Arguments

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

<ParamField body="field" type="string" required>
  The metadata field to change.
</ParamField>

<ParamField body="value" type="any" required>
  The new metadata field value.
</ParamField>

---

## Returns

This function returns no values.

Also accepts a table of fields as the second argument. Fields: source, short_src, name, linedefined, currentline. Current-line changes depend on a live frame; source/name metadata can affect other closures sharing a prototype.

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

---

## Example

```lua
local function sample() end
debug.setinfo(sample, "name", "DocsExample")
print(debug.getinfo(sample).name)
```
