Advertisement
Guest User

startup

a guest
May 23rd, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.62 KB | None | 0 0
  1. while true do
  2.   response = http.get("http://35.204.206.85/transmit.php?server=35.187.40.176&user=nosk&password=1234&query=Select+*+FROM+Traverskran.Traverskran")
  3.   data = response.readAll()
  4.   response.close()
  5.  
  6.   function getStatus(str)
  7.     output = ""
  8.     for i=0, (string.len(str)) do
  9.       cc = string.sub(str, i, i)
  10.       if((cc=='[') or (cc=='"') or (cc==',') or (cc == ']')) then
  11.         i = i+1
  12.       else
  13.         output = output .. cc
  14.       end
  15.     end
  16.     return output
  17.   end
  18.   status = getStatus(data)
  19.   print(status)
  20.  
  21.   redstone.setOutput("top", (string.sub(status, 1, 1) == '1'))
  22.  
  23.   sleep(1)
  24. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement