在go中使用lua示例, 基于gopher-lua!
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
 
 

24 lignes
371 B

package time
import (
lua "github.com/yuin/gopher-lua"
)
func PreLoadGo(L *lua.LState) {
L.PreloadModule("time", 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{
"unix": Unix,
"unix_nano": UnixNano,
"sleep": Sleep,
"parse": Parse,
"format": Format,
}