aesom_e

Computercraft Smarthome V1.0 (Controler side)

Dec 9th, 2019 (edited)
207
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.50 KB | None | 0 0
  1. local mdmside = ""
  2. local channel = 0
  3. local password = ""
  4. local noexit = true
  5. local modem = peripheral.wrap(mdmside)
  6. modem.open(channel)
  7. while noexit do
  8.     io.write("Smart home controller Command: ")
  9.     cmd = io.read()
  10.     if cmd == "/exit" then
  11.         term.clear()
  12.         term.setCursorPos(1, 1)
  13.         write("Password: ")
  14.         pswd = read("*")
  15.         if pswd == password then
  16.             noexit = false
  17.             print("Correct password")
  18.         else
  19.             print("Incorrect password")
  20.         end
  21.     else
  22.         modem.transmit(channel, channel, cmd)
  23.     end
  24. end
Add Comment
Please, Sign In to add comment