]> git.madduck.net Git - etc/awesome.git/blob - .config/awesome/debugfunc.lua

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

make new tags maximised (fixes new tag properties)
[etc/awesome.git] / .config / awesome / debugfunc.lua
1 gears = require("gears")
2
3 local module = {}
4
5 local function massage_args_for_debug_output(...)
6     local args = table.pack(...)
7     for i = 1,select('#', ...) do
8         args[i] = (args[i] and gears.debug.dump_return(args[i], i, 65535))
9                     or string.format('%d : %s', i, args[i])
10     end
11     return args
12 end
13
14 function module.sprintf(s, ...)
15     local args = massage_args_for_debug_output(...)
16     return string.format(s, table.unpack(args))
17 end
18
19 function module.printf(s, ...)
20     print(dsprintf(s, ...) or "(nil)")
21 end
22
23 function module.dump(...)
24     local args = massage_args_for_debug_output(...)
25     for _,v in ipairs(args) do
26         print(tostring(v))
27     end
28 end
29
30 return module