在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

il y a 4 ans
  1. package time
  2. import (
  3. lua "github.com/yuin/gopher-lua"
  4. )
  5. func PreLoadGo(L *lua.LState) {
  6. L.PreloadModule("time", Loader)
  7. }
  8. func Loader(L *lua.LState) int {
  9. t := L.NewTable()
  10. L.SetFuncs(t, api)
  11. L.Push(t)
  12. return 1
  13. }
  14. var api = map[string]lua.LGFunction{
  15. "unix": Unix,
  16. "unix_nano": UnixNano,
  17. "sleep": Sleep,
  18. "parse": Parse,
  19. "format": Format,
  20. }