Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- gestion ordi portable
- -- faire tbscreen.lua + rcscreen.lua
- --
- -- + qd tu clique ca provoque une erreur sur la reception de info.bt dans rcButton
- -------------------------------------------------//Initialisation
- local ptc = "reactorNetwork"
- local hostname = "rcServer"
- rednet.open("top")
- rednet.host(ptc, hostname)
- local rcScreen, tbScreen, rcComputer, rcButton, res
- local info = {}
- local button = {}
- -------------------------------------------------//Connection aux clients
- rcScreen = rednet.lookup(ptc, "rcScreen")
- tbScreen = rednet.lookup(ptc, "tbScreen")
- rcButton = rednet.lookup(ptc, "rcButton")
- rcComputer = rednet.lookup(ptc, "rcComputer")
- -------------------------------------------------//getInfo()
- function getInfo()
- print("Getting info ...")
- res, info = rednet.receive(ptc, 10)
- end
- -------------------------------------------------//sendInfo()
- function sendInfo()
- print("Sending info ...")
- rednet.send(rcScreen, info.rc, ptc)
- rednet.send(tbScreen, info.tb, ptc)
- rednet.send(rcButton, info.bt, ptc)
- end
- -------------------------------------------------//getButton()
- function getButton()
- print("Getting event ...")
- res, button = rednet.receive(ptc, 10)
- end
- -------------------------------------------------//sendComputer()
- function sendComputer()
- print("Sending event ...")
- rednet.send(rcComputer, button, ptc)
- end
- -------------------------------------------------//Main Script
- while(true)do
- os.sleep(0)
- getInfo()
- sendInfo()
- getButton()
- sendComputer()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement