Anonymous user
Module:IP: Difference between revisions
From the Croc Wiki, the Croc encyclopedia
Jump to navigationJump to search
use getmetatable to implement isSubnetObject
(prevent leading zeroes in CIDR strings and add some comments) |
(use getmetatable to implement isSubnetObject) |
||
Line 496:
do
-- Metatable
local mt = {
}
-- Private static methods
local function isSubnetObject(val)
return
end
Line 508 ⟶ 516:
makeSubnetFromRaw = function (rawIP, bitLength)
-- Set up structure
local obj = setmetatable({}, mt)
local data = {
rawIP = rawIP,
Line 589 ⟶ 597:
end
return
▲ end,
▲ __eq = function (self, obj)
▲ return self:getCIDR() == obj:getCIDR()
▲ end,
▲ __tostring = function (self)
▲ return self:getCIDR()
end
|