mirror of
https://github.com/bjc/prosody.git
synced 2025-04-04 21:57:45 +03:00
util.debug: Fix potential traceback
This commit is contained in:
parent
5785bdb7b6
commit
0f23c0b491
1 changed files with 6 additions and 4 deletions
|
@ -20,10 +20,12 @@ end
|
|||
|
||||
local function get_upvalues_table(func)
|
||||
local upvalues = {};
|
||||
for upvalue_num = 1, math.huge do
|
||||
local name, value = debug.getupvalue(func, upvalue_num);
|
||||
if not name then break; end
|
||||
table.insert(upvalues, { name = name, value = value });
|
||||
if func then
|
||||
for upvalue_num = 1, math.huge do
|
||||
local name, value = debug.getupvalue(func, upvalue_num);
|
||||
if not name then break; end
|
||||
table.insert(upvalues, { name = name, value = value });
|
||||
end
|
||||
end
|
||||
return upvalues;
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue