Networks
Base Access

You can access any object in a network, but it may require a bit more logic to get a port when there are multiple of them. Getting the life sensor without subnets could look like:
local lifeSensor
for _, port in GetPartsFromPort(GetPort(1), "Port") do
if port.PortID ~= 1 then continue end
lifeSensor = GetPartFromPort(port, "LifeSensor")
if lifeSensor then break end
end
Creating a Subnet

You can create a subnet simply by calling
Network:GetSubnet(Port)
. You can think of the port in the argument
as a microcontroller itself, and you can call
:GetPort()
or :GetPartFromPort()
on it. Now you
can get a life sensor like:
local network = Network:GetSubnet(GetPort(1))
local lifesensor = network:GetPartFromPort(1, "LifeSensor")
Subnets in Subnets

You can get subnets from subnets, too. Just call :GetSubnet()
on an existing subnet instead of Network
. Here's how you could
get the disk:
local network = Network:GetSubnet(GetPort(1))
local network2 = network:GetSubnet(network:GetPort(2))
local disk = network2:GetPartFromPort(3, "Disk")