This library provides the functionality of the debug interface to Lua programs. You should exert care when using this library. The functions provided here should be used exclusively for debugging and similar tasks, such as profiling. Please resist the temptation to use them as a usual programming tool: they can be very slow. Moreover, several of its functions violate some assumptions about Lua code (e.g., that variables local to a function cannot be accessed from outside or that userdata metatables cannot be changed by Lua code) and therefore can compromise otherwise secure code.

All functions in this library are provided inside the debug table. All functions that operate over a thread have an optional first argument which is the thread to operate over. The default is always the current thread.


Subsections

  1. debug.debug ()
  2. debug.getfenv (o)
  3. debug.gethook ([thread])
  4. debug.getinfo ([thread,] function [, what])
  5. debug.getlocal ([thread,] level, local)
  6. debug.getmetatable (object)
  7. debug.getregistry ()
  8. debug.getupvalue (func, up)
  9. debug.setfenv (object, table)
  10. debug.sethook ([thread,] hook, mask [, count])
  11. debug.setlocal ([thread,] level, local, value)
  12. debug.setmetatable (object, table)
  13. debug.setupvalue (func, up, value)
  14. debug.traceback ([thread,] [message] [, level])