aboutsummaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2020-10-11 20:25:32 +0100
committerMatthew Wild <mwild1@gmail.com>2020-10-11 20:25:32 +0100
commitc07d15cf71f962a64aa93cdf29d5fcf592a7548e (patch)
tree3e1a90aca9d08d978aeb6063e9e5eb68d3ad817a /util
parentbb3948c85772f99ab69876412e904b373841835d (diff)
downloadprosody-c07d15cf71f962a64aa93cdf29d5fcf592a7548e.tar.gz
prosody-c07d15cf71f962a64aa93cdf29d5fcf592a7548e.zip
util.startup: Handle missing nparams field from debug info (not present in 5.1)
Diffstat (limited to 'util')
-rw-r--r--util/startup.lua5
1 files changed, 3 insertions, 2 deletions
diff --git a/util/startup.lua b/util/startup.lua
index 358c491f..27420c57 100644
--- a/util/startup.lua
+++ b/util/startup.lua
@@ -198,11 +198,12 @@ function startup.set_function_metatable()
end
function mt.__tostring(f)
local info = debug.getinfo(f, "Su");
- for i = 1, info.nparams do
+ local n_params = info.nparams or 0;
+ for i = 1, n_params do
info[i] = debug.getlocal(f, i);
end
if info.isvararg then
- info[info.nparams+1] = "...";
+ info[n_params+1] = "...";
end
return ("function<%s:%d>(%s)"):format(info.short_src:match("[^\\/]*$"), info.linedefined, table.concat(info, ", "));
end