Software /
code /
prosody
Diff
util/ip.lua @ 11120:b2331f3dfeea
Merge 0.11->trunk
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Wed, 30 Sep 2020 09:50:33 +0100 |
parent | 10593:079b31c8dbf2 |
child | 11650:a227bc35771e |
line wrap: on
line diff
--- a/util/ip.lua Thu Oct 01 15:08:58 2020 +0100 +++ b/util/ip.lua Wed Sep 30 09:50:33 2020 +0100 @@ -19,8 +19,14 @@ return ret; end, __tostring = function (ip) return ip.addr; end, - __eq = function (ipA, ipB) return ipA.packed == ipB.packed; end }; +ip_mt.__eq = function (ipA, ipB) + if getmetatable(ipA) ~= ip_mt or getmetatable(ipB) ~= ip_mt then + -- Lua 5.3+ calls this if both operands are tables, even if metatables differ + return false; + end + return ipA.packed == ipB.packed; +end local hex2bits = { ["0"] = "0000", ["1"] = "0001", ["2"] = "0010", ["3"] = "0011",