Major updates/patches, functionality, api
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
30
scripting/regexp/regexp.go
Normal file
30
scripting/regexp/regexp.go
Normal file
@ -0,0 +1,30 @@
|
||||
package regexp
|
||||
|
||||
import (
|
||||
lua "github.com/yuin/gopher-lua"
|
||||
luar "layeh.com/gopher-luar"
|
||||
"regexp"
|
||||
)
|
||||
|
||||
func Loader(L *lua.LState) int {
|
||||
// register functions to the table
|
||||
mod := L.SetFuncs(L.NewTable(), exports)
|
||||
|
||||
// returns the module
|
||||
L.Push(mod)
|
||||
return 1
|
||||
}
|
||||
|
||||
var exports = map[string]lua.LGFunction{
|
||||
"MustCompile": compileFunc,
|
||||
}
|
||||
|
||||
func compileFunc(L *lua.LState) int {
|
||||
str := L.CheckString(1)
|
||||
|
||||
re := regexp.MustCompile(str)
|
||||
|
||||
L.Push(luar.New(L, re))
|
||||
|
||||
return 1
|
||||
}
|
Reference in New Issue
Block a user