mirror of https://github.com/Hilbis/Hilbish
fix: make table for `args` instead of using luar
parent
f60f61e616
commit
eaaf17a792
8
main.go
8
main.go
|
@ -17,7 +17,6 @@ import (
|
||||||
"github.com/pborman/getopt"
|
"github.com/pborman/getopt"
|
||||||
"github.com/yuin/gopher-lua"
|
"github.com/yuin/gopher-lua"
|
||||||
"golang.org/x/term"
|
"golang.org/x/term"
|
||||||
"layeh.com/gopher-luar"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -156,7 +155,12 @@ func main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if getopt.NArgs() > 0 {
|
if getopt.NArgs() > 0 {
|
||||||
l.SetGlobal("args", luar.New(l, getopt.Args()))
|
luaArgs := l.NewTable()
|
||||||
|
for _, arg := range getopt.Args() {
|
||||||
|
luaArgs.Append(lua.LString(arg))
|
||||||
|
}
|
||||||
|
|
||||||
|
l.SetGlobal("args", luaArgs)
|
||||||
err := l.DoFile(getopt.Arg(0))
|
err := l.DoFile(getopt.Arg(0))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Fprintln(os.Stderr, err)
|
fmt.Fprintln(os.Stderr, err)
|
||||||
|
|
Loading…
Reference in New Issue