From bf1b2d4f7c708c1448a19cae49bd3419b84aa748 Mon Sep 17 00:00:00 2001 From: NullBite Date: Sat, 24 Jun 2023 23:24:11 -0400 Subject: [PATCH] Add documentation to timers.lua --- timers.lua | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/timers.lua b/timers.lua index fab6f50..fea443e 100644 --- a/timers.lua +++ b/timers.lua @@ -4,6 +4,10 @@ timers={} do local timers = {} + --- Wait + --Wait a certain number of ticks and execute a function. + ---@param ticks integer Number of ticks to wait + ---@param next function Callback to run function wait(ticks,next) table.insert(timers, {t=world.getTime()+ticks,n=next}) end @@ -24,6 +28,12 @@ timers.wait=wait -- if timer is armed twice before expiring it will only be called once) -- do local timers = {} + --- Wait + --Wait a certain number of ticks and execute a function. Store the timer with a name so that + --it can be overwritten. + ---@param ticks integer Number of ticks to wait + ---@param next function Callback to run + ---@param name function Name of callback function namedWait(ticks, next, name) -- main difference, this will overwrite an existing timer with -- the same name