Software /
code /
prosody
Changeset
11152:89162d27e1b1
util.startup: Handle missing nparams field from debug info (not present in 5.1)
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Sun, 11 Oct 2020 20:25:32 +0100 |
parents | 11151:498b3ab49b9c |
children | 11153:e4075ca84a1a |
files | util/startup.lua |
diffstat | 1 files changed, 3 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/util/startup.lua Sun Oct 11 14:27:28 2020 +0200 +++ b/util/startup.lua Sun Oct 11 20:25:32 2020 +0100 @@ -198,11 +198,12 @@ 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