equal
deleted
inserted
replaced
21 elseif input:len() == 16 then |
21 elseif input:len() == 16 then |
22 local octets = { nil, nil, nil, nil, nil, nil, nil, nil }; |
22 local octets = { nil, nil, nil, nil, nil, nil, nil, nil }; |
23 |
23 |
24 -- Convert received bytes into IPv6 address and skip leading zeroes for each group |
24 -- Convert received bytes into IPv6 address and skip leading zeroes for each group |
25 for index = 1, 8 do |
25 for index = 1, 8 do |
26 high, low = input:byte(index * 2 - 1, index * 2); |
26 local high, low = input:byte(index * 2 - 1, index * 2); |
27 octets[index] = string.format("%x", high * 256 + low); |
27 octets[index] = string.format("%x", high * 256 + low); |
28 end |
28 end |
29 local address = table.concat(octets, ":", 1, 8); |
29 local address = table.concat(octets, ":", 1, 8); |
30 |
30 |
31 -- Search for the longest sequence of zeroes |
31 -- Search for the longest sequence of zeroes |