Software /
code /
prosody
Changeset
8428:ca44e462322c
util.ip: Reflow metatable
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 01 Dec 2017 01:55:15 +0100 |
parents | 8427:1371518f70ff |
children | 8429:b3562a1b1caa |
files | util/ip.lua |
diffstat | 1 files changed, 9 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/util/ip.lua Wed Nov 29 08:02:14 2017 +0100 +++ b/util/ip.lua Fri Dec 01 01:55:15 2017 +0100 @@ -6,9 +6,15 @@ -- local ip_methods = {}; -local ip_mt = { __index = function (ip, key) return (ip_methods[key])(ip); end, - __tostring = function (ip) return ip.addr; end, - __eq = function (ipA, ipB) return ipA.addr == ipB.addr; end}; + +local ip_mt = { + __index = function (ip, key) + return ip_methods[key](ip); + end, + __tostring = function (ip) return ip.addr; end, + __eq = function (ipA, ipB) return ipA.addr == ipB.addr; end +}; + local hex2bits = { ["0"] = "0000", ["1"] = "0001", ["2"] = "0010", ["3"] = "0011", ["4"] = "0100", ["5"] = "0101", ["6"] = "0110", ["7"] = "0111",