在go中使用lua示例, 基于gopher-lua!
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

21 lines
302 B

package crypto
import (
lua "github.com/yuin/gopher-lua"
)
func PreLoadGo(L *lua.LState) {
L.PreloadModule("crypto", Loader)
}
func Loader(L *lua.LState) int {
t := L.NewTable()
L.SetFuncs(t, api)
L.Push(t)
return 1
}
var api = map[string]lua.LGFunction{
"md5": MD5,
"sha256": SHA256,
}