return 0 from parameters outside of their procedure

This commit is contained in:
Michael "Z" Goddard 2018-10-04 21:30:12 -04:00
parent afd2ed72c8
commit fcafcbdd0a
No known key found for this signature in database
GPG key ID: 762CD40DD5349872
2 changed files with 7 additions and 2 deletions

View file

@ -54,7 +54,9 @@ class Scratch3ProcedureBlocks {
argumentReporterStringNumber (args, util) {
const value = util.getParam(args.VALUE);
if (value === null) {
return '';
// When the parameter is not found in the most recent procedure
// call, the default is always 0.
return 0;
}
return value;
}
@ -62,7 +64,9 @@ class Scratch3ProcedureBlocks {
argumentReporterBoolean (args, util) {
const value = util.getParam(args.VALUE);
if (value === null) {
return false;
// When the parameter is not found in the most recent procedure
// call, the default is always 0.
return 0;
}
return value;
}

View file

@ -349,6 +349,7 @@ class Thread {
if (frame.params.hasOwnProperty(paramName)) {
return frame.params[paramName];
}
return null;
}
return null;
}