From: Petr Špaček Date: Thu, 11 Apr 2019 13:57:06 +0000 (+0200) Subject: table_print: simplification X-Git-Tag: v4.0.0~9^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e44a31a20da5cd7ec8b97c50ab800b6b3275a5f3;p=thirdparty%2Fknot-resolver.git table_print: simplification As far as I understand the debug.sethook('call') descrption we are not going to have any locals except function parameters so we can simplify the code. --- diff --git a/daemon/lua/sandbox.lua.in b/daemon/lua/sandbox.lua.in index b09c87f87..59b9fcb04 100644 --- a/daemon/lua/sandbox.lua.in +++ b/daemon/lua/sandbox.lua.in @@ -377,16 +377,12 @@ local function funcsign(f) local function hook() delay = delay - 1 if delay == 0 then -- call this only for the introspected function - for i = 1, math.huge do - -- stack depth 2 is the introspected function + -- stack depth 2 is the introspected function + local debuginfo = debug.getinfo(2) + for i = 1, debuginfo.nparams do local k = debug.getlocal(2, i) - if (k or '('):sub(1, 1) == '(' then - break -- internal variable, skip - else - table.insert(func_args, k) - end + table.insert(func_args, k) end - local debuginfo = debug.getinfo(2) if debuginfo.what == 'C' then -- names N/A table.insert(func_args, '?') elseif debuginfo.isvararg then