Software /
code /
prosody
Diff
util/ip.lua @ 11200:bf8f2da84007
Merge 0.11->trunk
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Thu, 05 Nov 2020 22:31:25 +0100 |
parent | 10593:079b31c8dbf2 |
child | 11650:a227bc35771e |
line wrap: on
line diff
--- a/util/ip.lua Thu Nov 05 22:27:17 2020 +0100 +++ b/util/ip.lua Thu Nov 05 22:31:25 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",