Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- Made by Michal Nemecek. Please do not redistribute.
- ]]--
- rednet.open("back")
- while true do
- phout = nil
- phexists = false
- id,msg = rednet.receive()
- rs = msg:sub(1,1)
- if rs == "R" then
- if tonumber(msg:sub(2,10)) ~= nil and tonumber(msg:sub(11)) ~= nil then
- for line in io.lines("phonebook.txt") do
- if line:sub(1,9) == msg:sub(2,10) then
- phexists = true
- break
- end
- end
- end
- if not phexists then
- io.close("phonebook.txt")
- io.open("phonebook.txt","a")
- io.write(msg:sub(2))
- end
- elseif rs == "S" then
- for line in io.lines("phonebook.txt") do
- if line:sub(1,9) == msg:sub(2,10) then
- phexists = true
- phout = line:sub(10)
- rednet.send(tonumber(phout),msg:sub(11))
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement