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=" |
<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">/* |
<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 := " |
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)} |