github.com/treeverse/lakefs@v1.24.1-0.20240520134607-95648127bfb0/pkg/actions/lua/uuid/uuid.go (about)

     1  package uuid
     2  
     3  import (
     4  	"github.com/Shopify/go-lua"
     5  	"github.com/google/uuid"
     6  )
     7  
     8  var library = []lua.RegistryFunction{
     9  	{
    10  		Name: "new",
    11  		Function: func(l *lua.State) int {
    12  			l.PushString(uuid.NewString())
    13  			return 1
    14  		},
    15  	},
    16  }
    17  
    18  func Open(l *lua.State) {
    19  	require := func(l *lua.State) int {
    20  		lua.NewLibrary(l, library)
    21  		return 1
    22  	}
    23  	lua.Require(l, "uuid", require, false)
    24  	l.Pop(1)
    25  }