SHARE
TWEET

listen.lua

ktdm Jun 10th, 2017 75 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ender_net = require("ender-net")
  2. computer = require("computer")
  3.  
  4. print("Ожидание сообщений сети...\n\nНажмите [ENTER] чтобы выйти")
  5. while true do
  6.     local e = {computer.pullSignal(0)}
  7.     if e[1] == 'key_down' and e[4] == 28 then break end
  8.    
  9.     local messageRecieved, messageCode, message = ender_net.pullMessage()
  10.     if messageRecieved then
  11.         local text = ""
  12.         if type(message) == "number" then do text = tostring(message) end
  13.         else for k, v in pairs(message) do text = text..v.." " end end
  14.         print("\n-----------------------------------")
  15.         print("Код сообщения: "..messageCode)
  16.         print("Данные: "..text)
  17.         print("-----------------------------------")
  18.     end
  19. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top