From e70ea5d21ff1aca5b8c534da8f3a1ccadd330a2e Mon Sep 17 00:00:00 2001 From: Marcin Bukat Date: Sun, 28 Jun 2015 17:51:43 +0200 Subject: hwstub: Add completion and some pretty printing to the shell This uses slightly hacked luaprompt to provide all the goodis. See https://github.com/dpapavas/luaprompt for original. Change-Id: Iedddb79abae5809299322bc215722dd928c35cca --- utils/hwstub/tools/lua/hwlib.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'utils/hwstub/tools/lua') diff --git a/utils/hwstub/tools/lua/hwlib.lua b/utils/hwstub/tools/lua/hwlib.lua index 5bbd1e2668..02ab9718d4 100644 --- a/utils/hwstub/tools/lua/hwlib.lua +++ b/utils/hwstub/tools/lua/hwlib.lua @@ -22,6 +22,8 @@ function HWLIB.load_blob(filename, address) io.close(f) end -function HWLIB.printf(s,...) - return io.write(s:format(...)) +function HWLIB.printf(...) + local function wrapper(...) io.write(string.format(...)) end + local status, result = pcall(wrapper, ...) + if not status then error(result, 2) end end -- cgit v1.2.3