mirror of
https://github.com/MontFerret/ferret.git
synced 2024-12-14 11:23:02 +02:00
6933798419
* Some work * Updated Add operator * Updated Subtract operator * Updated Subtract operator tests * Added tests for multiplication * Added division * Updated the rest of operators
26 lines
559 B
Go
26 lines
559 B
Go
package utils
|
|
|
|
import (
|
|
"context"
|
|
"time"
|
|
|
|
"github.com/MontFerret/ferret/pkg/runtime/core"
|
|
"github.com/MontFerret/ferret/pkg/runtime/values"
|
|
)
|
|
|
|
// Wait pauses the execution for a given period.
|
|
// @param timeout (Float|Int) - Number value which indicates for how long to stop an execution.
|
|
func Wait(_ context.Context, args ...core.Value) (core.Value, error) {
|
|
err := core.ValidateArgs(args, 1, 1)
|
|
|
|
if err != nil {
|
|
return values.None, nil
|
|
}
|
|
|
|
arg := values.ToInt(args[0])
|
|
|
|
time.Sleep(time.Millisecond * time.Duration(arg))
|
|
|
|
return values.None, nil
|
|
}
|