forked from hkc/cc-stuff
22 lines
502 B
Lua
22 lines
502 B
Lua
|
|
||
|
peripheral.find("modem", function(name)
|
||
|
rednet.open(name)
|
||
|
print("Opened modem " .. name .. " for rednet connections")
|
||
|
end)
|
||
|
|
||
|
print("Hostname: " .. os.getComputerLabel())
|
||
|
print("ID: " .. os.getComputerID())
|
||
|
rednet.host("ramfs", os.getComputerLabel())
|
||
|
|
||
|
parallel.waitForAll(function()
|
||
|
while true do
|
||
|
local ev = { os.pullEvent() }
|
||
|
if ev[1] == "ramfs:shutdown" then
|
||
|
break
|
||
|
end
|
||
|
print(table.unpack(ev))
|
||
|
end
|
||
|
end, function() -- Shutdown routine
|
||
|
os.pullEvent("ramfs:shutdown")
|
||
|
end)
|