Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,6 @@
/* hostname.wren */
class Host {
foreign static name() // the code for this is provided by Go
}
System.print(Host.name())

View file

@ -0,0 +1,25 @@
/* hostname.go */
package main
import (
wren "github.com/crazyinfin8/WrenGo"
"os"
)
type any = interface{}
func hostname(vm *wren.VM, parameters []any) (any, error) {
name, _ := os.Hostname()
return name, nil
}
func main() {
vm := wren.NewVM()
fileName := "hostname.wren"
methodMap := wren.MethodMap{"static name()": hostname}
classMap := wren.ClassMap{"Host": wren.NewClass(nil, nil, methodMap)}
module := wren.NewModule(classMap)
vm.SetModule(fileName, module)
vm.InterpretFile(fileName)
vm.Free()
}