Module net

Network utility functions.

This module provides helper functions for network-related operations, primarily for converting between string and integer representations of IPv4 addresses.

Functions

aton (addr) Converts an IPv4 address string to its integer representation.
ntoa (ip) Converts an integer representation of an IPv4 address to its string form.


Functions

aton (addr)
Converts an IPv4 address string to its integer representation. "Address to Number"

Parameters:

  • addr (string) The IPv4 address string (e.g., "127.0.0.1").

Returns:

    (number) The IPv4 address as an integer.

Usage:

    local ip_int = net.aton("192.168.1.1")
ntoa (ip)
Converts an integer representation of an IPv4 address to its string form. "Number to Address"

Parameters:

  • ip (number) The IPv4 address as an integer.

Returns:

    (string) The IPv4 address string (e.g., "127.0.0.1").

Usage:

    local ip_str = net.ntoa(3232235777)  -- "192.168.1.1"
generated by LDoc 1.5.0 Last updated 2025-06-27 17:53:55