mirror of https://github.com/Hilbis/Hilbish
feat: run script when provided path
parent
b39083fe32
commit
e91cf98634
13
main.go
13
main.go
|
@ -10,6 +10,7 @@ import (
|
||||||
"runtime"
|
"runtime"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"hilbish/util"
|
||||||
"hilbish/golibs/bait"
|
"hilbish/golibs/bait"
|
||||||
|
|
||||||
rt "github.com/arnodel/golua/runtime"
|
rt "github.com/arnodel/golua/runtime"
|
||||||
|
@ -151,17 +152,17 @@ func main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if getopt.NArgs() > 0 {
|
if getopt.NArgs() > 0 {
|
||||||
/*luaArgs := l.NewTable()
|
luaArgs := rt.NewTable()
|
||||||
for _, arg := range getopt.Args() {
|
for i, arg := range getopt.Args() {
|
||||||
luaArgs.Append(lua.LString(arg))
|
luaArgs.Set(rt.IntValue(int64(i + 1)), rt.StringValue(arg))
|
||||||
}
|
}
|
||||||
|
|
||||||
l.SetGlobal("args", luaArgs)
|
l.GlobalEnv().Set(rt.StringValue("args"), rt.TableValue(luaArgs))
|
||||||
err := l.DoFile(getopt.Arg(0))
|
err := util.DoFile(l, getopt.Arg(0))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Fprintln(os.Stderr, err)
|
fmt.Fprintln(os.Stderr, err)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}*/
|
}
|
||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue