Comparison

net/dns.lua @ 7480:3dc7de31d3d1

net.dns: don't use "for s,s in pairs..." (unused loop variable s) [luacheck]
author Anton Shestakov <av6@dwimlabs.net>
date Sat, 09 Jul 2016 10:26:18 +0800
parent 7469:363e4a5e9b0a
child 7500:4c519444d4a2
comparison
equal deleted inserted replaced
7479:a82f88db12f7 7480:3dc7de31d3d1
1009 return (hints[s] and hints[s][p[s]]) or ''; 1009 return (hints[s] and hints[s][p[s]]) or '';
1010 end 1010 end
1011 1011
1012 1012
1013 function resolver.print(response) -- - - - - - - - - - - - - resolver.print 1013 function resolver.print(response) -- - - - - - - - - - - - - resolver.print
1014 for s,s in pairs { 'id', 'qr', 'opcode', 'aa', 'tc', 'rd', 'ra', 'z', 1014 for _, s in pairs { 'id', 'qr', 'opcode', 'aa', 'tc', 'rd', 'ra', 'z',
1015 'rcode', 'qdcount', 'ancount', 'nscount', 'arcount' } do 1015 'rcode', 'qdcount', 'ancount', 'nscount', 'arcount' } do
1016 print( string.format('%-30s', 'header.'..s), response.header[s], hint(response.header, s) ); 1016 print( string.format('%-30s', 'header.'..s), response.header[s], hint(response.header, s) );
1017 end 1017 end
1018 1018
1019 for i,question in ipairs(response.question) do 1019 for i,question in ipairs(response.question) do
1022 print(string.format ('question[%i].class ', i), question.class); 1022 print(string.format ('question[%i].class ', i), question.class);
1023 end 1023 end
1024 1024
1025 local common = { name=1, type=1, class=1, ttl=1, rdlength=1, rdata=1 }; 1025 local common = { name=1, type=1, class=1, ttl=1, rdlength=1, rdata=1 };
1026 local tmp; 1026 local tmp;
1027 for s,s in pairs({'answer', 'authority', 'additional'}) do 1027 for _, s in pairs({'answer', 'authority', 'additional'}) do
1028 for i,rr in pairs(response[s]) do 1028 for i,rr in pairs(response[s]) do
1029 for j,t in pairs({ 'name', 'type', 'class', 'ttl', 'rdlength' }) do 1029 for j,t in pairs({ 'name', 'type', 'class', 'ttl', 'rdlength' }) do
1030 tmp = string.format('%s[%i].%s', s, i, t); 1030 tmp = string.format('%s[%i].%s', s, i, t);
1031 print(string.format('%-30s', tmp), rr[t], hint(rr, t)); 1031 print(string.format('%-30s', tmp), rr[t], hint(rr, t));
1032 end 1032 end