Module:IP/doc: Difference between revisions

From the Croc Wiki, the Croc encyclopedia
Jump to navigationJump to search
Content added Content deleted
(fix comment syntax errors)
(don't bold "Examples")
Line 19: Line 19:
The ipString variable can be a valid IPv4 or IPv6 address.
The ipString variable can be a valid IPv4 or IPv6 address.


'''Examples'''
Examples:


<source lang="lua">
<source lang="lua">
Line 67: Line 67:
Returns a string representation of the IP address. IPv6 addresses are abbreviated if possible.
Returns a string representation of the IP address. IPv6 addresses are abbreviated if possible.


'''Examples'''
Examples:


<source lang="lua">
<source lang="lua">
Line 83: Line 83:
Returns the version of the IP protocol being used. This is "IPv4" for IPv4 addresses, and "IPv6" for IPv6 addresses.
Returns the version of the IP protocol being used. This is "IPv4" for IPv4 addresses, and "IPv6" for IPv6 addresses.


'''Examples'''
Examples:


<source lang="lua">
<source lang="lua">
Line 98: Line 98:
Returns true if the IP address is an IPv4 address, and false otherwise.
Returns true if the IP address is an IPv4 address, and false otherwise.


'''Examples'''
Examples:


<source lang="lua">
<source lang="lua">
Line 113: Line 113:
Returns true if the IP address is an IPv6 address, and false otherwise.
Returns true if the IP address is an IPv6 address, and false otherwise.


'''Examples'''
Examples:


<source lang="lua">
<source lang="lua">
Line 128: Line 128:
Returns true if the IP address is in the subnet <var>subnet</var>, and false otherwise. <var>subnet</var> may be a [[#Subnet|Subnet object]] or a [[CIDR]] string.
Returns true if the IP address is in the subnet <var>subnet</var>, and false otherwise. <var>subnet</var> may be a [[#Subnet|Subnet object]] or a [[CIDR]] string.


'''Examples'''
Examples:


<source lang="lua">
<source lang="lua">
Line 145: Line 145:
Returns a Subnet object for the subnet with a bit length of <var>bitLength</var> which contains the current IP. The <var>bitLength</var> parameter must be an integer between 0 and 32 for IPv4 addresses, or an integer between 0 and 128 for IPv6 addresses.
Returns a Subnet object for the subnet with a bit length of <var>bitLength</var> which contains the current IP. The <var>bitLength</var> parameter must be an integer between 0 and 32 for IPv4 addresses, or an integer between 0 and 128 for IPv6 addresses.


'''Examples'''
Examples:


<source lang="lua">
<source lang="lua">
Line 159: Line 159:
Returns a new IPAddress object equivalent to the current IP address incremented by one. The IPv4 address "255.255.255.255" rolls around to "0.0.0.0", and the IPv6 address "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff" rolls around to "::".
Returns a new IPAddress object equivalent to the current IP address incremented by one. The IPv4 address "255.255.255.255" rolls around to "0.0.0.0", and the IPv6 address "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff" rolls around to "::".


'''Examples'''
Examples:


<source lang="lua">
<source lang="lua">
Line 175: Line 175:
Returns a new IPAddress object equivalent to the current IP address decremented by one. The IPv4 address "0.0.0.0" rolls around to "255.255.255.255", and the IPv6 address "::" rolls around to "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff".
Returns a new IPAddress object equivalent to the current IP address decremented by one. The IPv4 address "0.0.0.0" rolls around to "255.255.255.255", and the IPv6 address "::" rolls around to "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff".


'''Examples'''
Examples:


<source lang="lua">
<source lang="lua">