csmit195

Nighttime Detector CC

Jan 15th, 2018
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.27 KB | None | 0 0
  1. local nightTime
  2.  
  3. function init()
  4.     while true do
  5.         rs.setOutput('top', not isNight())
  6.         sleep(5000)
  7.     end
  8. end
  9.  
  10. function isNight()
  11.     local currentTime = os.time()
  12.     if ( currentTime >= 18.541 or currentTime <= 6 ) then
  13.         return true
  14.     end
  15.     return false
  16. end
  17.  
  18. init()
Advertisement
Add Comment
Please, Sign In to add comment