Anonymous user
Module:IP: Difference between revisions
From the Croc Wiki, the Croc encyclopedia
Jump to navigationJump to search
add type checks to IPAddress
(check self parameters in IPAddress methods) |
(add type checks to IPAddress) |
||
Line 7:
local libraryUtil = require('libraryUtil')
local checkType = libraryUtil.checkType
local checkTypeMulti = libraryUtil.checkTypeMulti
-- Constants
Line 412 ⟶ 413:
function obj:isInSubnet(subnet)
checkSelf('isInSubnet', self)
checkTypeMulti('isInSubnet', 1, subnet, {'string', 'table'})
return subnet:containsIP(self)
end
Line 417 ⟶ 419:
function obj:getSubnet(bitLength)
checkSelf('getSubnet', self)
checkType('getSubnet', 1, bitLength, 'number')
return makeSubnet(data.rawIP, bitLength)
end
|