Software /
code /
prosody
Comparison
util/debug.lua @ 4519:510f4ba7080f
util.debug: Attempt to get debug.traceback() parameter handling correct (again)
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Thu, 22 Mar 2012 15:07:27 +0000 |
parent | 4465:41c4252526bd |
child | 4520:2d85ac26799c |
comparison
equal
deleted
inserted
replaced
4518:f2d695d2e31e | 4519:510f4ba7080f |
---|---|
93 thread, message, level = coroutine.running(), thread, message; | 93 thread, message, level = coroutine.running(), thread, message; |
94 end | 94 end |
95 if level and type(message) ~= "string" then | 95 if level and type(message) ~= "string" then |
96 return nil, "invalid message"; | 96 return nil, "invalid message"; |
97 elseif not level then | 97 elseif not level then |
98 level = message or 2; | 98 if type(message) == "number" then |
99 level, message = message, nil; | |
100 else | |
101 level = 2; | |
102 end | |
99 end | 103 end |
100 | 104 |
101 message = message and (message.."\n") or ""; | 105 message = message and (message.."\n") or ""; |
102 | 106 |
103 local levels = get_traceback_table(thread, level+2); | 107 local levels = get_traceback_table(thread, level+2); |