diff --git a/README.md b/README.md index f405aba..144d379 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ Features - - Simple to "install". Simply copy debugger.lua into your project then load it using local dbg = require(). -- Conditional assert-style breakpoints. +- Conditional, assert-style breakpoints. - Colored output and GNU readline support where applicable. - Easy to set it up to break on assert() or error() - dbg.call() works similar to xpcall() but starts the debugger when an error occurs. @@ -103,4 +103,4 @@ Future Plans: debugger.lua basically does everything I want now, although I have some ideas for enhancements. -- Custom formatters: The built in pretty-printing works fine for most things. It would be nice to be able to register custom formatting functions though. +- C API: Make the debugger easily embedable from C as a second option. I have a solution I'm mostly happy with in my current project. It exposes a dbg_setup() function to preload the debugger, and a dbg_call() function that works like lua_pcall(), but starts the debugger automaticall when an error occurs. Just needs some cleaning up. diff --git a/debugger.lua b/debugger.lua index 358d5bb..5c000f7 100644 --- a/debugger.lua +++ b/debugger.lua @@ -447,9 +447,9 @@ end -- Conditionally enable color support. local color_maybe_supported = (stdout_isatty and os.getenv("TERM") and os.getenv("TERM") ~= "dumb") if color_maybe_supported and not os.getenv("DBG_NOCOLOR") then - COLOR_RED = "\x1b[31m" - COLOR_BLUE = "\x1b[34m" - COLOR_RESET = "\x1b[0m" + COLOR_RED = string.char(27) .. "[31m" + COLOR_BLUE = string.char(27) .. "[34m" + COLOR_RESET = string.char(27) .. "[0m" end -- Conditionally enable LuaJIT readline support.