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/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)