From: Peter van Dijk Date: Mon, 26 Feb 2018 13:49:37 +0000 (+0100) Subject: luabackend: do not _tostring t tables and userdata X-Git-Tag: dnsdist-1.3.0~66^2~13 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d1d5e3de0f573614a8eece7bf056f6eeb6c7e528;p=pdns luabackend: do not _tostring t tables and userdata --- diff --git a/modules/luabackend/lua_functions.cc b/modules/luabackend/lua_functions.cc index f06f1f8fd..5c6212787 100644 --- a/modules/luabackend/lua_functions.cc +++ b/modules/luabackend/lua_functions.cc @@ -136,12 +136,12 @@ int l_dnspacket (lua_State *lua) { int l_logger (lua_State *lua) { // assert(lua == lb->lua); - lua_getfield(lua, LUA_REGISTRYINDEX, "__LUABACKEND"); - LUABackend* lb = (LUABackend*)lua_touserdata(lua, -1); - int i = lua_gettop(lua); if (i < 1) - return 0; + return 0; + + lua_getfield(lua, LUA_REGISTRYINDEX, "__LUABACKEND"); + LUABackend* lb = (LUABackend*)lua_touserdata(lua, -1); int log_level = 0; stringstream s; diff --git a/modules/luabackend/test2/pdns-luabackend.lua b/modules/luabackend/test2/pdns-luabackend.lua index 6a577f204..c22da8202 100644 --- a/modules/luabackend/test2/pdns-luabackend.lua +++ b/modules/luabackend/test2/pdns-luabackend.lua @@ -168,7 +168,7 @@ function get() logger(log_debug, "(l_get) begin") while rrsetidx < rrsetsize do rrsetidx = rrsetidx + 1 - logger(log_debug, "(l_get) rrset ", rrsetidx, " : ", rrset[rrsetidx]) + logger(log_debug, "(l_get) rrset ", rrsetidx) return rrset[rrsetidx] end logger(log_debug, "(l_get) done")