Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- rednet.open('top')
- adress_list= {10}
- function pop(adress,path)
- for i=1,#adress_list do
- if (adress_list[i] == adress) then
- local data= {}
- data[1]= 'pop'
- data[2]= path
- createclaim(adress,data)
- d,stat= receivereply(adress)
- if (stat == true) then
- draw(d)
- end
- end
- end
- end
- function draw(arr)
- for i=1,#arr do
- print(arr[i])
- end
- end
- function createclaim(adress,data)
- local d= {}
- d= textutils.serialize(data)
- rednet.send(adress,d)
- end
- function receivereply(adress)
- while true do
- local data= {}
- id,message= rednet.receive()
- if (id == adress and message ~= nil) then
- data= textutils.unserialize(message)
- if (data[1] == 'true' and data[2] == 'pop') then
- local d= {}
- for i=3,#data do
- d[#d+1]= data[i]
- end
- return d,true
- elseif (data[1] == 'false' and data[2] == 'pop') then
- d= data
- print('path not found')
- return d,false
- end
- end
- end
- end
- while true do
- write('/')
- adr= ''
- adr= read()
- pop(10,adr)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement