Skip to content

Debug in Lua

This document introduces 2 simple methods to debug Lua code.

debug library

function myfunction ()
   print(debug.traceback("Stack trace"))
   print(debug.getinfo(1, "Sl"))
   print("Stack trace end")

   return 10

myfunction ()
  • n selects fields name and namewhat
  • f selects field func
  • S selects fields source, short_src, what, and linedefined
  • l selects field currentline
  • u selects field nup




  1. License under CC BY-NC 4.0
  2. Copyright issue feedback: dig +short txt
  3. Not all the commands and scripts are tested in production environment, use at your own risk
  4. No privacy information is collected here
Buy Me a Coffee