[nga-c] now report 0 for script:arguments count if not running a program

FossilOrigin-Name: 926e685b338c07722000d4d4d659674fdbcfb77c5f970283596f10ec18ad8b1a
This commit is contained in:
crc 2024-07-18 10:24:37 +00:00
parent 565d567523
commit 25420eea5d
2 changed files with 5 additions and 1 deletions

View file

@ -53,6 +53,7 @@
- new "-p" option to run non-Unu format source files - new "-p" option to run non-Unu format source files
- now report "<none>" for `script:name` if no file is being - now report "<none>" for `script:name` if no file is being
run run
- now report 0 for `script:arguments` if not running a program
Future Notes Future Notes

View file

@ -551,7 +551,10 @@ V scripting_arg(NgaState *vm) {
} }
V scripting_arg_count(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) { V scripting_include(NgaState *vm) {