Lua.VM.ErrorFormatter (Lua v1.0.0-rc.0)

View Source

Beautiful error formatting for Lua runtime errors.

Provides detailed error messages with:

  • ANSI-colored error type headers
  • Clear error messages
  • Source context with line numbers and pointer
  • Stack traces
  • Suggestions for common mistakes

Summary

Functions

Formats a runtime error into a beautiful multi-line string.

Functions

format(error_type, message, opts \\ [])

Formats a runtime error into a beautiful multi-line string.

Options

  • :source - Source file name
  • :line - Line number where error occurred
  • :call_stack - List of stack frames
  • :source_code - Full source code for context display
  • :error_kind - Structured error kind atom for suggestions (e.g., :call_nil, :call_non_function, :index_non_table)
  • :value_type - Type of the problematic value (e.g., :number, :string, :table)