Module:IP/doc: Difference between revisions

From the Croc Wiki, the Croc encyclopedia
Jump to navigationJump to search
add overlapsSubnet
(→‎getRanges: add a comment)
(add overlapsSubnet)
Line 467:
-- },
-- }
</source>
 
=== overlapsSubnet ===
 
<source lang="lua">
collection:overlapsSubnet(subnet)
</source>
 
Returns true, obj if <var>subnet</var> overlaps this collection, where obj is the first [[#IPAddress|IPAddress]] or [[#Subnet|Subnet]] object overlapping the subnet. Otherwise, returns false. <var>subnet</var> can be a CIDR string or a [[#Subnet|Subnet]] object.
 
Examples:
 
<source lang="lua">
collection:addIP('1.2.3.4')
collection:overlapsSubnet('1.2.3.0/24') -- true, IPAddress.new('1.2.3.4')
collection:overlapsSubnet('1.2.4.0/24') -- false
</source>
 
Cookies help us deliver our services. By using our services, you agree to our use of cookies.

Navigation menu