Advertisement
Kodos

Try this!

Jul 1st, 2014
249
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. timer = function (time)
  2. local init = os.time()
  3. local diff=os.difftime(os.time(),init)
  4. while diff<time do
  5. coroutine.yield(diff)
  6. diff=os.difftime(os.time(),init)
  7. end
  8. print( 'Timer timed out at '..time..' seconds!')
  9. end
  10. co=coroutine.create(timer)
  11. coroutine.resume(co,30) -- timer starts here!
  12. while coroutine.status(co)~="dead" do
  13. print("time passed",select(2,coroutine.resume(co)))
  14. print('',coroutine.status(co))
  15. os.sleep(5)
  16. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement