net.isalive readonly property
The net.isalive property checks if a network connection is available, returning true or false otherwise.
Example
if require("net").isalive then
print("This computer is connected to the network")
else
print("This computer is not connected to the network")
end