diff options
-rw-r--r-- | README.rst | 7 | ||||
-rw-r--r-- | lua/inet/set.lua | 2 |
2 files changed, 5 insertions, 4 deletions
@@ -474,13 +474,14 @@ Remove network from set. ``set:contains(foo)`` ~~~~~~~~~~~~~~~~~~~~~ -Is the network contained or equal to a network in the set? +If the network is contained or equal to a network in the set, then +the matching network will be returned, otherwise false is. :: - foo:contains(inet('2001:db8::')) -- returns true + foo:contains(inet('2001:db8::')) -- returns inet('2001:db8::/48') foo:contains(inet('2001:db8::/32')) -- returns false - foo:contains(inet('2001:db8::/48')) -- returns true + foo:contains(inet('2001:db8::/48')) -- returns inet('2001:db8::/48') foo:contains(inet('2001:db8:1:2:3:4:5:6')) -- returns false ``set:flush()`` diff --git a/lua/inet/set.lua b/lua/inet/set.lua index a5d9056..c96a57b 100644 --- a/lua/inet/set.lua +++ b/lua/inet/set.lua @@ -173,7 +173,7 @@ function inet_set:contains(net) for i=1,#nets do local n = nets[i] if n == net or n:contains(net) then - return true + return n end end return false |