mirror of
https://github.com/bjc/prosody.git
synced 2025-04-03 21:27:38 +03:00
util.ip: Reflow metatable
This commit is contained in:
parent
c8323e953d
commit
af801d58cb
1 changed files with 9 additions and 3 deletions
12
util/ip.lua
12
util/ip.lua
|
@ -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",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue