caucow

ctrlout

Dec 28th, 2016 (edited)
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.56 KB | None | 0 0
  1. multishell.setTitle(multishell.getCurrent(), "out")
  2. local m = peripheral.find("modem")
  3. local senderID = os.getComputerLabel() == nil and "ID:" .. os.getComputerID() or os.getComputerLabel()
  4. local channels = {
  5.       ["stdout"] = 1000,
  6.       ["stdin"] = 1001,
  7.       ["witherout"] = 1010,
  8.       ["witherin"] = 1011
  9.     }
  10. m.open(channels.stdout)
  11.  
  12. while true do
  13.   evt, face, sendCh, replyCh, msg, dist = os.pullEvent("modem_message")
  14.   local textLen = #msg.text
  15.   for i = 1, textLen do
  16.     print("[" .. msg.sender .. ":" .. msg.type .. "] " .. msg.text[i])
  17.   end
  18. end
Add Comment
Please, Sign In to add comment