https://github.com/tsileo/gluarequire2
gluarequire2 provides a way to import file directly from GitHub using GopherLua.
https://github.com/tsileo/gluarequire2
go lua
Last synced: about 1 month ago
JSON representation
gluarequire2 provides a way to import file directly from GitHub using GopherLua.
- Host: GitHub
- URL: https://github.com/tsileo/gluarequire2
- Owner: tsileo
- License: mit
- Created: 2017-06-11T08:10:23.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2020-02-22T09:44:33.000Z (over 6 years ago)
- Last Synced: 2025-01-22T00:51:36.852Z (over 1 year ago)
- Topics: go, lua
- Language: Go
- Homepage: https://a4.io/gluarequire2
- Size: 5.86 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# gluarequire2
[](https://builds.sr.ht/~tsileo/gluarequire2?)
[](https://godoc.org/a4.io/gluarequire2)
gluarequire2 provides a way to import file directly from GitHub using [GopherLua](https://github.com/yuin/gopher-lua).
Files are downloaded on the fly via HTTP (and stored in `/tmp`), then `require2` rewrite the imports to the right location.
## Installation
```shell
$ go get a4.io/gluarequire2
```
### QuickStart
```go
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)
}
}
```