I'm in the process of writing a text adventure parser.
By default, the parser simply uses Stdin.

i e 

for {
        fmt.Print(">>> ")

        reader := bufio.NewScanner(os.Stdin)
        for reader.Scan() {
            switch reader.Text() {
...
...

This is quite convenient. However, I now want to be able to pass in text 
from outside this for-loop. Say I have a function "Invoke(arg string)" 
which I should be able to call to pass
arguments straight to the Scanner interface.

What would be the most straightforward way to achieve this?

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/b34d4bea-d819-4832-9ebd-db11709d6b0c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to