Groovy web console

subscribe to the feed Subscribe
to this
site
embed in your blog Embed
this
script
mic (via #groovywebconsole)
tweet this snippet Tweet
this
script

To embed this script in your site, just drop the content below where you want to embed it.

mic

Published 1 month ago by mic
Actions  ➤ Edit in console Back to console Show/hide line numbers View recent scripts
class Game {
    void go(dir) {
        println "You go $dir"
    }
def propertyMissing(String name) {
        name    
    }
}


def game = new Game()
// marche bien : String playerInput = "go 'north'"
String playerInput = "go north"
def binding = new Binding([game: game])
new GroovyShell(binding).evaluate("game.${playerInput}")

Recent scripts