Skip to content
This repository has been archived by the owner on Nov 2, 2020. It is now read-only.

ozanh/tengox

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tengox

I archived this repo in favor of a new script language uGO for Go.

Experimental features for Tengo Scripting Language

A special thanks to Tom Gascoigne for his contribution.

tengox is created to call callable Tengo functions from Go in an easier way. Please see tests, example files and godoc.

You should pin tengox to a git tag (if any) in your go.mod file to use the stable code.

func ExampleCompiled_CallByName() {
	module := `add := func(a, b, c) { return a + b + c; }`
	script := tengox.NewScript([]byte(module))
	// script is compiled and run
	compl, err := script.CompileRun() // CompileRunContext() is available
	if err != nil {
		panic(err)
	}
	// CallByNameContext() is available
	v, err := compl.CallByName("add", 1, 2, 3) // 1+2+3
	if err != nil {
		panic(err)
	}
	fmt.Println(v)
	//Output: 6

	// you can clone your compiled code like this
	// clone := compl.Clone()
	// cloned code run in a different VM
}

About

Experimental features for Tengo Scripting Language

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages