mirror of
https://github.com/Ukendio/jecs.git
synced 2025-04-24 17:10:03 +00:00
19 lines
No EOL
254 B
Text
19 lines
No EOL
254 B
Text
local function interval(s)
|
|
local pin
|
|
|
|
local function throttle()
|
|
if not pin then
|
|
pin = os.clock()
|
|
end
|
|
|
|
local elapsed = os.clock() - pin > s
|
|
if elapsed then
|
|
pin = os.clock()
|
|
end
|
|
|
|
return elapsed
|
|
end
|
|
return throttle
|
|
end
|
|
|
|
return interval |