fix: make table for `args` instead of using luar

dev
TorchedSammy 2021-12-06 16:32:34 -04:00
parent f60f61e616
commit eaaf17a792
Signed by: sammyette
GPG Key ID: 904FC49417B44DCD
1 changed files with 6 additions and 2 deletions

View File

@ -17,7 +17,6 @@ import (
"github.com/pborman/getopt"
"github.com/yuin/gopher-lua"
"golang.org/x/term"
"layeh.com/gopher-luar"
)
var (
@ -156,7 +155,12 @@ func main() {
}
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))
if err != nil {
fmt.Fprintln(os.Stderr, err)