Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- executes function after 10 seconds
- timer:Simple(10, function()
- print("This function was delayed for 10 seconds!")
- end)
- -- executes function 5 times every 10 seconds
- timer:Create("SomeUniqueTimerName", 10, 5, function()
- print(os.time())
- end)
- -- executes every 10 seconds
- -- reps is 0 => infinite repetitions
- timer:Create("SomeUniqueTimerName", 10, 0, function()
- -- do smth here
- end)
- -- delay is 0 => executes each tick
- timer:Create("SomeUniqueTimerName", 0, 0, function()
- -- do smth here
- end)
- -- removes any timer
- -- returns `true` if the given timer existed else `false`
- timer:Remove("SomeUniqueTimerName") -> bool
- -- returns `true` if the given timer exists else `false
- timer:Exists("SomeUniqueTimerName") -> bool
- -- restart any timer - drops current repetitions to original
- -- explanation:
- -- if base reps = 10 and the given timer executed already 4 times then this method do from 6 remaining reps to 10
- -- returns `true` if the given timer successfully restarted (if existed) else `false`
- timer:Start("SomeUniqueTimerName") -> bool
- -- pause the timer
- -- returns `true` if the given timer successfully paused
- -- returns `false` if the given timer doesn't exists or this one already paused
- timer:Pause("SomeUniqueTimerName") -> bool
- -- unpause the timer
- -- returns `true` if the given timer successfully unpaused
- -- returns `false` if the given timer doesn't exists or this one wasn't paused/already unpaused
- timer:UnPause("SomeUniqueTimerName") -> bool
- -- toggle the pause state of timer
- -- returns `true` if the given timer successfully unpaused
- -- returns `false` if the given timer doesn't exists
- timer:Toggle("SomeUniqueTimerName") -> bool
- -- returns amount of time (in a seconds) before the given timer will execute the function for the last time and be removed
- -- if the given timer doesn't exists then returns `nil`
- timer:TimeLeft("SomeUniqueTimerName") -> int
- -- returns amount of time (in a seconds) before the given timer will execute the function for the next time
- -- if the given timer doesn't exists then returns `nil`
- timer:NextTimeLeft("SomeUniqueTimerName") -> int
- -- returns amount after how many repetitions the given timer will execute the function for the last time and be removed
- -- if the given timer doesn't exists then returns `nil`
- timer:RepsLeft("SomeUniqueTimerName") -> int
Advertisement
Add Comment
Please, Sign In to add comment