Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local component = require("component")
- local shell = require("shell")
- local args = shell.parse(...)
- local event = require "event"
- function ping(port)
- print("port, " .. port)
- component.modem.open(port)
- component.modem.broadcast(port, "Hello World")
- end
- function recive(eventType,addressReciving,addressSending,distance,port,message)
- print("Event type is " .. eventType)
- print("Reciving address is " .. addressReciving)
- print("Sending address is " .. addressSending)
- print("Distance is " .. distance)
- print("Message is " .. message)
- print("file name, " .. args[2])
- local archive = io.open(name .. ".txt", "w")
- local working = io.open("workingaddress.txt", "a")
- archive:write(address)
- working:write(address)
- archive:close()
- working:close()
- end
- do
- ping(tonumber(args[1]))
- event.listen("modem_message", recive)
- end
Add Comment
Please, Sign In to add comment