diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 00ddf82..926e0c6 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -53,6 +53,7 @@ - new "-p" option to run non-Unu format source files - now report "" for `script:name` if no file is being run + - now report 0 for `script:arguments` if not running a program Future Notes diff --git a/vm/nga-c/retro.c b/vm/nga-c/retro.c index 22a41f8..228b842 100644 --- a/vm/nga-c/retro.c +++ b/vm/nga-c/retro.c @@ -551,7 +551,10 @@ V scripting_arg(NgaState *vm) { } V scripting_arg_count(NgaState *vm) { - stack_push(vm, vm->sys_argc - 2); + if ((vm->sys_argc - 2) <= 0) + stack_push(vm, 0); + else + stack_push(vm, vm->sys_argc - 2); } V scripting_include(NgaState *vm) {