IRC gateway: Difference between revisions
Content added Content deleted
Thundergnat (talk | contribs) m (syntax highlighting fixup automation) |
m (→{{header|Wren}}: Minor tidy) |
||
Line 300: | Line 300: | ||
As it's not possible to access command line arguments directly from Wren when it is being embedded, we instead ask the gateway user to input details of the connections needed. |
As it's not possible to access command line arguments directly from Wren when it is being embedded, we instead ask the gateway user to input details of the connections needed. |
||
<syntaxhighlight lang=" |
<syntaxhighlight lang="wren">/* IRC_gateway.wren */ |
||
import "./dynamic" for Tuple |
import "./dynamic" for Tuple |
||
Line 358: | Line 358: | ||
}</syntaxhighlight> |
}</syntaxhighlight> |
||
We now embed this script in the following Go program and run it from a terminal. To close the gateway just press Ctrl-C. |
We now embed this script in the following Go program and run it from a terminal. To close the gateway just press Ctrl-C. |
||
<syntaxhighlight lang="go">/* go run |
<syntaxhighlight lang="go">/* go run IRC_gateway.go */ |
||
package main |
package main |
||
Line 489: | Line 489: | ||
cfg.LoadModuleFn = moduleFn |
cfg.LoadModuleFn = moduleFn |
||
vm := cfg.NewVM() |
vm := cfg.NewVM() |
||
var fileName = " |
var fileName = "IRC_gateway.wren" |
||
IRCMethodMap := wren.MethodMap{ |
IRCMethodMap := wren.MethodMap{ |
||
"connect(_)": connect, |
"connect(_)": connect, |