From 508fd5f8a2b48510725014d379fa697c5936554a Mon Sep 17 00:00:00 2001 From: TorchedSammy <38820196+TorchedSammy@users.noreply.github.com> Date: Tue, 12 Apr 2022 19:37:15 -0400 Subject: [PATCH] docs: update docs for timer related functions --- api.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/api.go b/api.go index 5c139f3..5181d29 100644 --- a/api.go +++ b/api.go @@ -471,8 +471,10 @@ func hlgoro(t *rt.Thread, c *rt.GoCont) (rt.Cont, error) { // timeout(cb, time) // Runs the `cb` function after `time` in milliseconds +// Returns a `timer` object (see `doc timers`). // --- @param cb function // --- @param time number +// --- @return table func hltimeout(t *rt.Thread, c *rt.GoCont) (rt.Cont, error) { if err := c.CheckNArgs(2); err != nil { return nil, err @@ -494,9 +496,11 @@ func hltimeout(t *rt.Thread, c *rt.GoCont) (rt.Cont, error) { } // interval(cb, time) -// Runs the `cb` function every `time` milliseconds +// Runs the `cb` function every `time` milliseconds. +// Returns a `timer` object (see `doc timers`). // --- @param cb function // --- @param time number +// --- @return table func hlinterval(t *rt.Thread, c *rt.GoCont) (rt.Cont, error) { if err := c.CheckNArgs(2); err != nil { return nil, err @@ -511,7 +515,7 @@ func hlinterval(t *rt.Thread, c *rt.GoCont) (rt.Cont, error) { } interval := time.Duration(ms) * time.Millisecond - timer := timers.create(timerInterval, interval, cb) + timer := timers.creat(timerInterval, interval, cb) timer.start() return c.PushingNext1(t.Runtime, timer.lua()), nil