aboutsummaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
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