glox/globals.go

14 lines
199 B
Go
Raw Normal View History

2024-10-09 19:57:52 +03:00
package main
import "time"
func defineGlobals(env *Environment) {
2024-10-11 17:01:12 +03:00
env.define("clock", &Callable{
2024-10-09 19:57:52 +03:00
arity: 0,
call: func(i *Interpreter, arg ...any) any {
return time.Now().Unix()
},
})
}