mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2025-07-23 04:31:25 -04:00
Cast 'create clone' argument to string. Resolves GH-974
This commit is contained in:
parent
cde801bc17
commit
218725d771
1 changed files with 9 additions and 3 deletions
|
@ -144,15 +144,21 @@ class Scratch3ControlBlocks {
|
||||||
}
|
}
|
||||||
|
|
||||||
createClone (args, util) {
|
createClone (args, util) {
|
||||||
|
// Cast argument to string
|
||||||
|
args.CLONE_OPTION = Cast.toString(args.CLONE_OPTION);
|
||||||
|
|
||||||
|
// Set clone target
|
||||||
let cloneTarget;
|
let cloneTarget;
|
||||||
if (args.CLONE_OPTION === '_myself_') {
|
if (args.CLONE_OPTION === '_myself_') {
|
||||||
cloneTarget = util.target;
|
cloneTarget = util.target;
|
||||||
} else {
|
} else {
|
||||||
cloneTarget = this.runtime.getSpriteTargetByName(args.CLONE_OPTION);
|
cloneTarget = this.runtime.getSpriteTargetByName(args.CLONE_OPTION);
|
||||||
}
|
}
|
||||||
if (!cloneTarget) {
|
|
||||||
return;
|
// If clone target is not found, return
|
||||||
}
|
if (!cloneTarget) return;
|
||||||
|
|
||||||
|
// Create clone
|
||||||
const newClone = cloneTarget.makeClone();
|
const newClone = cloneTarget.makeClone();
|
||||||
if (newClone) {
|
if (newClone) {
|
||||||
this.runtime.targets.push(newClone);
|
this.runtime.targets.push(newClone);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue