Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
6
Task/Hostname/Wren/hostname-1.wren
Normal file
6
Task/Hostname/Wren/hostname-1.wren
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
/* hostname.wren */
|
||||
class Host {
|
||||
foreign static name() // the code for this is provided by Go
|
||||
}
|
||||
|
||||
System.print(Host.name())
|
||||
25
Task/Hostname/Wren/hostname-2.wren
Normal file
25
Task/Hostname/Wren/hostname-2.wren
Normal 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()
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue