~tsileo/gluarequire2

gluarequire2 provides a way to import file directly from GitHub using GopherLua.
Switch to go mod and cleanup

refs

master
browse  log 

clone

read-only
https://git.sr.ht/~tsileo/gluarequire2
read/write
git@git.sr.ht:~tsileo/gluarequire2

You can also use your local clone with git send-email.

#gluarequire2

builds.sr.ht 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)
	}
}