The Central Go Modules Repository

To use GoCenter:
export GOPROXY=https://gocenter.io
0
Stars
MIT
License
46
Downloads
February 22nd 2020
Last Modified
Version:
Loading...

gluarequire2

Build Status    Godoc Reference

gluarequire2 provides a way to import file directly from GitHub using GopherLua.

Files are downloaded on the fly via HTTP (and stored in /tmp), then require2 rewrite the imports to the right location.

Installation

$ go get a4.io/gluarequire2

QuickStart

package main

import (
	"a4.io/gluarequire2"
	"github.com/yuin/gopher-lua"
)

func main() {
	L := lua.NewState()
	defer L.Close()

	gluarequire2.NewRequire2Module(gluarequire2.NewRequireFromGitHub(nil)).SetGlobal(L)

	if err := L.DoString(`

        local mymod = require2('github.com/tsileo/gluarequire2/_tests/testmod')
	assert(mymod.return1() == 1)

    `); err != nil {
		panic(err)
	}
}