Advertisement
9551

ticklib

Jun 13th, 2021
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.52 KB | None | 0 0
  1. ---tick counter lib---
  2. --this lib is not 100% accurate !---
  3. --lib by elektrobom1--
  4. local function tick(ltc)
  5.     if type(ltc) ~= "string" then
  6.         error("this function requires C lamp to work!", 0)
  7.     end
  8.     local change = 3600
  9.     local ot = (os.time("utc") * change)
  10.     local tick = 0
  11.     repeat
  12.         peripheral.call(ltc, "setLampColor", 0)
  13.         tick = tick + 1
  14.     until ot < os.time("utc") * change
  15.     if tick > 20 then
  16.         tick = 20
  17.     end
  18.     return (tick)
  19. end
  20.  
  21. return {tick = tick}
  22.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement