在go中使用lua示例, 基于gopher-lua!
Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

26 linhas
450 B

há 4 anos
  1. package strings
  2. import (
  3. lua "github.com/yuin/gopher-lua"
  4. )
  5. func PreLoadGo(L *lua.LState) {
  6. L.PreloadModule("strings", 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. "split": Split,
  16. "trim": Trim,
  17. "trim_prefix": TrimPrefix,
  18. "trim_suffix": TrimSuffix,
  19. "has_prefix": HasPrefix,
  20. "has_suffix": HasSuffix,
  21. "contains": Contains,
  22. }