2
2
mirror of https://github.com/Hilbis/Hilbish synced 2025-04-02 03:33:22 +00:00

fix!: make path to script the 0th arg instead of 1st

makes more sense, brings some lua parity
this means that user passed args start from 1
instead of 2
This commit is contained in:
TorchedSammy 2022-04-13 20:19:28 -04:00
parent 194e4e01b7
commit e3fdf84f5c
Signed by: sammyette
GPG Key ID: 904FC49417B44DCD

View File

@ -155,7 +155,7 @@ func main() {
if getopt.NArgs() > 0 {
luaArgs := rt.NewTable()
for i, arg := range getopt.Args() {
luaArgs.Set(rt.IntValue(int64(i + 1)), rt.StringValue(arg))
luaArgs.Set(rt.IntValue(int64(i)), rt.StringValue(arg))
}
l.GlobalEnv().Set(rt.StringValue("args"), rt.TableValue(luaArgs))