Environment variables: Difference between revisions

Content added Content deleted
No edit summary
m (→‎{{header|Wren}}: Minor tidy)
Line 1,338: Line 1,338:


However, if Wren is embedded in (say) a suitable Go program, then we can ask the latter to obtain it for us.
However, if Wren is embedded in (say) a suitable Go program, then we can ask the latter to obtain it for us.
<syntaxhighlight lang="ecmascript">/* environment_variables.wren */
<syntaxhighlight lang="wren">/* Environment_variables.wren */
class Environ {
class Environ {
foreign static variable(name)
foreign static variable(name)
Line 1,347: Line 1,347:
which we embed in the following Go program and run it.
which we embed in the following Go program and run it.
{{libheader|WrenGo}}
{{libheader|WrenGo}}
<syntaxhighlight lang="go">/* environment_variables.go */
<syntaxhighlight lang="go">/* Environment_variables.go */
package main
package main


Line 1,364: Line 1,364:
func main() {
func main() {
vm := wren.NewVM()
vm := wren.NewVM()
fileName := "environment_variables.wren"
fileName := "Environment_variables.wren"
methodMap := wren.MethodMap{"static variable(_)": getEnvironVariable}
methodMap := wren.MethodMap{"static variable(_)": getEnvironVariable}
classMap := wren.ClassMap{"Environ": wren.NewClass(nil, nil, methodMap)}
classMap := wren.ClassMap{"Environ": wren.NewClass(nil, nil, methodMap)}