]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
adds tostring support to the qtype argument table
authortcely <tcely@users.noreply.github.com>
Mon, 4 Jun 2018 06:19:54 +0000 (02:19 -0400)
committertcely <tcely@users.noreply.github.com>
Mon, 4 Jun 2018 06:19:54 +0000 (02:19 -0400)
modules/luabackend/minimal.cc

index 9286814b43b017077602cc31e28b251a2fbe4779..83e94c5a4a86c2224314903b29b7388b45643ae6 100644 (file)
@@ -112,6 +112,12 @@ void LUABackend::lookup(const QType &qtype, const DNSName &qname, DNSPacket *p,
     lua_pushliteral(lua, "code");
     lua_pushinteger(lua, qtype.getCode());
     lua_settable(lua, -3);
+    lua_newtable(lua);
+    if(0 == luaL_loadstring(lua, "return function (t) return t.name end")) {
+       lua_call(lua, 0, 1);
+       lua_setfield(lua, -2, "__tostring");
+    }
+    lua_setmetatable(lua, -2);
 
     lua_pushstring(lua, qname.toString().c_str());
     lua_pushinteger(lua, domain_id);