storj/cmd/statreceiver/luacfg/cfg_test.go

28 lines
411 B
Go
Raw Normal View History

2019-01-24 20:15:10 +00:00
// Copyright (C) 2019 Storj Labs, Inc.
2019-01-01 09:41:27 +00:00
// 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
}