Anonymous user
Module:IP: Difference between revisions
From the Croc Wiki, the Croc encyclopedia
Jump to navigationJump to search
validate ip in subnet:containsIP(ip) and accept a string, like ip:isInSubnet(subnet)
(add check self functions to Subnet) |
(validate ip in subnet:containsIP(ip) and accept a string, like ip:isInSubnet(subnet)) |
||
Line 583:
function obj:containsIP(ip)
checkSelf(self, 'containsIP')
local tp = type(ip)
if tp == 'string' then
ip = makeIPAddress(ip)
elseif tp == 'table' then
validateIPAddress('containsIP', 1, ip)
else
checkTypeMulti('containsIP', 1, ip, {'string', 'table'})
end
if self:getVersion() == ip:getVersion() then
return self:getPrefix() <= ip and ip <= self:getHighestIP()
|