func newRegex(t *rt.Thread, c *rt.GoCont) (rt.Cont, *rt.Error) {
	var s string
	err := c.Check1Arg()
	if err == nil {
		s, err = c.StringArg(0)
	}
	if err != nil {
		return nil, err.AddContext(c)
	}
	re, compErr := regexp.Compile(string(s))
	if compErr != nil {
		return nil, rt.NewErrorE(compErr).AddContext(c)
	}
	return c.PushingNext(rt.UserDataValue(rt.NewUserData(re, regexMeta))), nil
}
Creates a new regex userdata from a string.
package regexlib
import (
	"fmt"
	"regexp"
	"github.com/arnodel/golua/lib/packagelib"
	rt "github.com/arnodel/golua/runtime"
)
var regexMeta *rt.Table
var LibLoader = packagelib.Loader{
	Load: load,
	Name: "regex",
}
func load(r *rt.Runtime) rt.Value {
	pkg := rt.NewTable()
	rt.SetEnvGoFunc(pkg, "new", newRegex, 1, false)
	return rt.TableValue(pkg)
}