Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local protocol = "inventory_main"
- local hostname = "c1"
- rednet.open("top")
- local inventories = {}
- local names = peripheral.getNames()
- for _, name in pairs(names) do
- if peripheral.hasType(name, "inventory") then
- print("found inventory:", name)
- table.insert(inventories, peripheral.wrap(name))
- end
- end
- while true do
- local computers = {rednet.lookup(protocol)}
- for _, computer in pairs(computers) do
- for i, value in pairs(inventories) do
- local message = {
- id=computer,
- name=i,
- data=value.list()
- }
- rednet.send(computer, message, protocol)
- end
- for i = 1, 10, 1 do
- rednet.send(computer, "test", "turtle")
- sleep(0.1)
- end
- end
- sleep(1)
- --local id, message = rednet.receive(protocol)
- --print(id, message)
- end
Advertisement
Add Comment
Please, Sign In to add comment