Advertisement
viggo99

Receiving Lua Commands

Oct 14th, 2018
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.54 KB | None | 0 0
  1. rednet.open("back")
  2. local x = 1
  3. while true do
  4.   sleep(1)
  5.   local monitor = peripheral.wrap("top")
  6.   local senderID, message, distance = rednet.receive()
  7.   if message == "clear()" then
  8.   monitor.clear()
  9.   monitor.setCursorPos(1,1)
  10.   x = 1
  11.   elseif message == "nline()" then
  12.   x = x + 1
  13.   monitor.setCursorPos(1,x)
  14.   else
  15.     local index = string.find(message.." ","/n")
  16.     if index == nil then
  17.         shell.run(message)
  18.     else
  19.         x = x + 1
  20.         monitor.setCursorPos(1,x)
  21.         message = message:gsub("%/n", "")
  22.         shell.run(message)
  23.     end
  24.  end
  25. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement