diff options
author | Matthew Wild <mwild1@gmail.com> | 2020-10-11 20:25:32 +0100 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2020-10-11 20:25:32 +0100 |
commit | 1adf1d813b9e1ddb3578d55f22e5e77c45877f49 (patch) | |
tree | 3e1a90aca9d08d978aeb6063e9e5eb68d3ad817a /util | |
parent | bee9a3d1994caf188e149a695bae3073361a2608 (diff) | |
download | prosody-1adf1d813b9e1ddb3578d55f22e5e77c45877f49.tar.gz prosody-1adf1d813b9e1ddb3578d55f22e5e77c45877f49.zip |
util.startup: Handle missing nparams field from debug info (not present in 5.1)
Diffstat (limited to 'util')
-rw-r--r-- | util/startup.lua | 5 |
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 |