sWaffle7982

server

Aug 5th, 2021 (edited)
40
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.87 KB | None | 0 0
  1. --[[===================
  2.  
  3. Made by: Nemo Eriksson
  4. Pastebin: UxdzXDmM
  5.  
  6. ====================]]--
  7.  
  8. function main()
  9.  
  10.   -- Opens wireless modem om right side of computer
  11.   rednet.open('right')
  12.  
  13.   -- Wait for message
  14.   while true do
  15.     senderId, message, protocol = rednet.receive()
  16.     currentTime = os.date()
  17.  
  18.  
  19.     -- Print message for user to read
  20.     print('=========================')
  21.     print('Got message from #'..senderId)
  22.     print('Content:', message)
  23.     print('Time:', currentTime)
  24.     print('=========================\n')
  25.  
  26.     os.sleep(5)
  27.   end
  28.  
  29. end
  30.  
  31. -- Prints when the computer program started
  32. local startTime = os.date()
  33. print('Stared at: '..startTime)
  34.  
  35. -- Print the current computer ID
  36. local serverId = os.getComputerID()
  37. os.setComputerLabel('Server #'..serverId)
  38. print('Current server id: #'..serverId)
  39.  
  40. -- Actually do the stuff
  41. main()
  42.  
Advertisement
Add Comment
Please, Sign In to add comment