From 3c5d25ccb7b3c78a79a8ee168f2757b4f51593b2 Mon Sep 17 00:00:00 2001 From: Brett Smith Date: Wed, 11 Nov 2015 09:10:57 -0500 Subject: [PATCH 1/2] Fixed color output Not sure why, but the escapes don't seem to work on Mac. Changed it to string.char instead. --- debugger.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/debugger.lua b/debugger.lua index 1d9fb68..c738534 100644 --- a/debugger.lua +++ b/debugger.lua @@ -439,9 +439,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. From ce23585b385d267d2f0cdfe1bb5267bbf25c981b Mon Sep 17 00:00:00 2001 From: Scott Lembcke Date: Wed, 11 Nov 2015 08:46:28 -0600 Subject: [PATCH 2/2] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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.