Comparison

util/ip.lua @ 7481:b3a864df32ef

util.ip: remove unused one-letter loop variables [luacheck]
author Anton Shestakov <av6@dwimlabs.net>
date Sat, 09 Jul 2016 10:27:57 +0800
parent 7061:eda0feeaf759
child 7486:c415a3fd4485
comparison
equal deleted inserted replaced
7480:3dc7de31d3d1 7481:b3a864df32ef
49 ip = (ip.addr):upper(); 49 ip = (ip.addr):upper();
50 ip:gsub("([^:]*):?", function (c) fields[#fields + 1] = c end); 50 ip:gsub("([^:]*):?", function (c) fields[#fields + 1] = c end);
51 if not ip:match(":$") then fields[#fields] = nil; end 51 if not ip:match(":$") then fields[#fields] = nil; end
52 for i, field in ipairs(fields) do 52 for i, field in ipairs(fields) do
53 if field:len() == 0 and i ~= 1 and i ~= #fields then 53 if field:len() == 0 and i ~= 1 and i ~= #fields then
54 for i = 1, 16 * (9 - #fields) do 54 for _ = 1, 16 * (9 - #fields) do
55 result = result .. "0"; 55 result = result .. "0";
56 end 56 end
57 else 57 else
58 for i = 1, 4 - field:len() do 58 for _ = 1, 4 - field:len() do
59 result = result .. "0000"; 59 result = result .. "0000";
60 end 60 end
61 for i = 1, field:len() do 61 for i = 1, field:len() do
62 result = result .. hex2bits[field:sub(i,i)]; 62 result = result .. hex2bits[field:sub(i,i)];
63 end 63 end