A bunch of programs for computercraft
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

15 lines
417 B

function lookup (name)
local resolv = fs.open('/etc/resolv.conf','r')
local ns=tonumber(resolv.readLine())
local message=textutils.serialize({"CNT",name})
rednet.send(ns,message)
local senderId, reply, distance = rednet.receive()
local count = 0
while senderId ~= ns do
local senderId, reply, distance = rednet.receive()
end
local address=textutils.unserialize(reply)
return address[2]
end