Anonymous user
Module:IP: Difference between revisions
From the Croc Wiki, the Croc encyclopedia
Jump to navigationJump to search
Undid revision 731014195 by Johnuniq (talk) this breaks equality testing, as __eq needs to use the same function object, not just an equivalent anonymous function
(mt variable not needed for Subnet; this is similar to IPAddress) |
|||
Line 489:
-- is a Subnet object.
local uniqueKey = {}
-- Metatable
local mt = {
}
-- Private static methods
Line 506 ⟶ 520:
makeSubnetFromRaw = function (rawIP, bitLength)
-- Set up structure
local obj = setmetatable({},
▲ __eq = function (self, obj)
▲ return self:getCIDR() == obj:getCIDR()
▲ end,
▲ __concat = function (self, obj)
▲ return tostring(self) .. tostring(obj)
▲ end,
▲ __tostring = function (self)
▲ return self:getCIDR()
▲ end,
▲ __metatable = uniqueKey,
local data = {
rawIP = rawIP,
|