From fd478e883f4dd8ee905f8dabb116e55488cfad7c Mon Sep 17 00:00:00 2001 From: sammy <38820196+TorchedSammy@users.noreply.github.com> Date: Tue, 11 May 2021 19:37:00 -0400 Subject: [PATCH] feat: args variable (resolves #49) anytime hilbish is ran as shebang or given a script to run, itll provide an `args` variable which will be the args a user provides to the script. it includes the execute path, as most argv's do --- main.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/main.go b/main.go index 74b14fd..9c1295f 100644 --- a/main.go +++ b/main.go @@ -14,6 +14,7 @@ import ( "github.com/pborman/getopt" "github.com/bobappleyard/readline" "github.com/yuin/gopher-lua" + "layeh.com/gopher-luar" "golang.org/x/term" ) @@ -118,6 +119,7 @@ func main() { RunInput(*cmdflag) if getopt.NArgs() > 0 { + l.SetGlobal("args", luar.New(l, getopt.Args())) err := l.DoFile(getopt.Arg(0)) if err != nil { fmt.Fprintln(os.Stderr, err)