Skip to content
This repository was archived by the owner on Nov 2, 2020. It is now read-only.
/ tengox Public archive

Experimental features for Tengo Scripting Language

License

Notifications You must be signed in to change notification settings

ozanh/tengox

Folders and files

NameName
Last commit message
Last commit date

Latest commit

author
Ozan Hacıbekiroğlu
Nov 2, 2020
c383800 · Nov 2, 2020

History

9 Commits
May 13, 2020
May 13, 2020
Nov 2, 2020
May 15, 2020
May 13, 2020
May 13, 2020
May 15, 2020
May 15, 2020

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