> ## Documentation Index
> Fetch the complete documentation index at: https://docs.projectreal.gg/llms.txt
> Use this file to discover all available pages before exploring further.

# getinfo

> Returns a metadata table for a function or stack level. target must be a function or number. Invalid target types raise "function or number expected", invalid stack levels raise "Level out of range", and unavailable levels raise "invalid level". The returned table includes func, nups, source, short_src, currentline, what, linedefined, is_vararg, numparams, and name. sizep is included only for direct Lua function targets. debug.getinfo is an alias.

<div className="real-function-page">
  ```lua theme={null}
  getinfo(target: function | number): table
  ```

  ## Alias

  * `debug.getinfo`

  ## Argumentos

  <ParamField path={"target"} type={"function | number"} required>
    Function or stack level number to inspect.
  </ParamField>

  ## Retornos

  <ResponseField name={"info"} type={"table"}>
    Metadata table containing func, nups, source, short\_src, currentline, what, linedefined, is\_vararg, numparams, name, and sizep only for direct Lua function targets.
  </ResponseField>

  ## Ejemplo

  Read the metadata table for a function or stack level.

  ```lua theme={null}
  local function target()
      return "ready"
  end

  local info = getinfo(target)

  print(info.source)
  print(info.currentline)
  print(info.numparams)
  print(info.sizep)
  print(debug.getinfo(target).what)
  ```
</div>
