In the wiki we can see how to use timers:
local demoTimer = hl.timer(function()
print("hello from timer")
end, { timeout = 1000, type = "repeat" })
type = "repeat" means, this timer runs forever or until it is disabled:
demoTimer:set_enabled(false)
Is there a way to create a single shot timer that triggers only one time?
What other types are possible instead of type = "repeat"?
Thanks
Peter
local demoTimer = hl.timer(function()
print("hello from timer")
end, { timeout = 1000, type = "oneshot" })
Oh, yes, it works. Thank you!
From where do you know this? From where could I have known this?
Regards
Peter
The stub:
"HL.TimerOptions",
[
("timeout", "integer", False),
("type", '"repeat"|"oneshot"', False),
],
---@class HL.TimerOptions
467 │ ---@field timeout integer
468 │ ---@field type "repeat"|"oneshot"
469 │ local __HL_TimerOptions = {}