mirror of https://github.com/Hilbis/Hilbish
feat: add goro function
this function will run another function, but in a goroutine !!pull/59/head
parent
9defa737f4
commit
c1b9e5bc81
6
lua.go
6
lua.go
|
@ -12,6 +12,7 @@ import (
|
|||
"hilbish/golibs/fs"
|
||||
|
||||
"github.com/yuin/gopher-lua"
|
||||
"layeh.com/gopher-luar"
|
||||
)
|
||||
|
||||
var minimalconf = `
|
||||
|
@ -30,6 +31,7 @@ func LuaInit() {
|
|||
l.SetGlobal("alias", l.NewFunction(hshalias))
|
||||
l.SetGlobal("appendPath", l.NewFunction(hshappendPath))
|
||||
l.SetGlobal("exec", l.NewFunction(hshexec))
|
||||
l.SetGlobal("goro", luar.New(l, hshgoroutine))
|
||||
|
||||
// yes this is stupid, i know
|
||||
l.PreloadModule("hilbish", HilbishLoader)
|
||||
|
@ -151,3 +153,7 @@ func hshexec(L *lua.LState) int {
|
|||
syscall.Exec(cmdPath, cmdArgs, os.Environ())
|
||||
return 0 // random thought: does this ever return?
|
||||
}
|
||||
|
||||
func hshgoroutine(gofunc func()) {
|
||||
go gofunc()
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue