bytepath/def/Timer.d.lua
2025-11-10 01:02:09 -03:00

59 lines
1.6 KiB
Lua

---@meta
---@module 'hump.timer'
---@class Timer
local Timer = {}
---Create a new timer instance.
---@return Timer
function Timer.new() end
---Update the timer. Must be called every frame.
---@param dt number
function Timer:update(dt) end
---Schedule a function to run after a delay.
---@param delay number
---@param func function
---@param ... any Arguments to pass to func
---@return function cancel_function
function Timer:after(delay, func, ...) end
---Schedule a function to run every interval.
---@param interval number
---@param func function
---@param ... any Arguments to pass to func
---@return function cancel_function
function Timer:every(interval, func, ...) end
---Schedule a function to run during a duration, with optional easing.
---@param duration number
---@param subject table
---@param target table
---@param easing? string
---@param after? function
---@return function cancel_function
function Timer:tween(duration, subject, target, easing, after) end
---Cancel a scheduled timer function.
---@param handle function The handle returned by after/every/tween
function Timer:cancel(handle) end
---Clear all scheduled timers.
function Timer:clear() end
---Run a function over time (tween-like, but returns handle).
---@param duration number
---@param func function
---@param ... any
---@return function cancel_function
function Timer:during(duration, func, ...) end
---Run a function every frame for a duration.
---@param duration number
---@param func function
---@param ... any
---@return function cancel_function
function Timer:script(duration, func, ...) end
return Timer