From a78a3a0e6a97957dd039a552ef56390d136d5ccb Mon Sep 17 00:00:00 2001 From: Remi Gacogne Date: Fri, 6 Nov 2015 15:09:18 +0100 Subject: [PATCH] Add default values for topResponses() and topQueries() parameters. Fixes #2864. Use 10 as a default 'top' parameter for topQueries() and topResponses(), and 0 as the default 'kind' parameter for topResponses(). --- pdns/dnsdist-lua.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pdns/dnsdist-lua.cc b/pdns/dnsdist-lua.cc index 3afa7923b..8d10c9fc1 100644 --- a/pdns/dnsdist-lua.cc +++ b/pdns/dnsdist-lua.cc @@ -651,7 +651,7 @@ vector> setupLua(bool client, const std::string& confi }); - g_lua.executeCode(R"(function topQueries(top, labels) for k,v in ipairs(getTopQueries(top,labels)) do show(string.format("%4d %-40s %4d %4.1f%%",k,v[1],v[2], v[3])) end end)"); + g_lua.executeCode(R"(function topQueries(top, labels) top = top or 10; for k,v in ipairs(getTopQueries(top,labels)) do show(string.format("%4d %-40s %4d %4.1f%%",k,v[1],v[2], v[3])) end end)"); @@ -723,7 +723,7 @@ vector> setupLua(bool client, const std::string& confi }); - g_lua.executeCode(R"(function topResponses(top, kind, labels) for k,v in ipairs(getTopResponses(top, kind, labels)) do show(string.format("%4d %-40s %4d %4.1f%%",k,v[1],v[2], v[3])) end end)"); + g_lua.executeCode(R"(function topResponses(top, kind, labels) top = top or 10; kind = kind or 0; for k,v in ipairs(getTopResponses(top, kind, labels)) do show(string.format("%4d %-40s %4d %4.1f%%",k,v[1],v[2],v[3])) end end)"); g_lua.writeFunction("showResponseLatency", []() { -- 2.40.0