Documentation ¶
Overview ¶
Example ¶
package main import ( "bytes" "fmt" "storj.io/storj/cmd/statreceiver/luacfg" ) func main() { 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
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Scope ¶
type Scope struct {
// contains filtered or unexported fields
}
Scope represents a collection of values registered in a Lua namespace.
func (*Scope) RegisterType ¶
RegisterType allows you to add a Lua function that creates new values of the given type to the scope.
func (*Scope) RegisterVal ¶
RegisterVal adds the Go value 'value', including Go functions, to the Lua scope.
Click to show internal directories.
Click to hide internal directories.