storj/cmd/statreceiver/luacfg/cfg_test.go
2019-01-01 11:41:27 +02:00

28 lines
411 B
Go

// Copyright (C) 2018 Storj Labs, Inc.
// See LICENSE for copying information.
package luacfg_test
import (
"bytes"
"fmt"
"storj.io/storj/cmd/statreceiver/luacfg"
)
func Example() {
scope := luacfg.NewScope()
err := scope.RegisterVal("print", fmt.Println)
if err != nil {
panic(err)
}
err = scope.Run(bytes.NewBufferString(`print "hello"`))
if err != nil {
panic(err)
}
// Output: hello
}