aboutsummaryrefslogtreecommitdiffstats
path: root/util/debug.lua
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2013-08-11 10:42:58 +0100
committerMatthew Wild <mwild1@gmail.com>2013-08-11 10:42:58 +0100
commitb2ea2f6d0801a1a0c77b38cfdd1fdd5384bf662e (patch)
tree84873ffba6446c70ddea2873643f2ab2bb62f7a1 /util/debug.lua
parent8cb1b88d435aa8e4710c2544c00a58ebb87d757b (diff)
downloadprosody-b2ea2f6d0801a1a0c77b38cfdd1fdd5384bf662e.tar.gz
prosody-b2ea2f6d0801a1a0c77b38cfdd1fdd5384bf662e.zip
util.debug: Fix level of locals when inspecting a coroutine
Diffstat (limited to 'util/debug.lua')
-rw-r--r--util/debug.lua10
1 files changed, 6 insertions, 4 deletions
diff --git a/util/debug.lua b/util/debug.lua
index 417359f8..91f691e1 100644
--- a/util/debug.lua
+++ b/util/debug.lua
@@ -25,12 +25,14 @@ end
module("debugx", package.seeall);
function get_locals_table(thread, level)
- if not thread then
- level = level + 1; -- Skip this function itself
- end
local locals = {};
for local_num = 1, math.huge do
- local name, value = debug.getlocal(thread, level, local_num);
+ local name, value;
+ if thread then
+ name, value = debug.getlocal(thread, level, local_num);
+ else
+ name, value = debug.getlocal(level+1, local_num);
+ end
if not name then break; end
table.insert(locals, { name = name, value = value });
end