kopia lustrzana https://github.com/backface/turtlestitch
deep copy atomic lists sent from one scene to another
rodzic
f1a5031b7b
commit
f926c8f5a3
|
@ -49,6 +49,7 @@
|
|||
* blocks: only show "key" upvar in the "When ... is pressed" hat if "any key" is selected
|
||||
* blocks: tweaked blocks layout for hidden expansion slots
|
||||
* blocks, objects, store, threads: made SEND blocks expandable for receivers and renamed them back to BROADCAST
|
||||
* threads: deep copy atomic lists sent from one scene to another
|
||||
|
||||
### 2021-10-21
|
||||
* threads, objects: make "when I receive 'any message'" hat scripts threadsafe (uninterruptable by other messages)
|
||||
|
|
|
@ -4683,12 +4683,16 @@ Process.prototype.doSwitchToScene = function (id, transmission) {
|
|||
ide, scenes, num, scene;
|
||||
this.assertAlive(rcvr);
|
||||
this.assertType(message, ['text', 'number', 'Boolean', 'list']);
|
||||
if (message instanceof List && !message.canBeJSON()) {
|
||||
if (message instanceof List) {
|
||||
// make sure only atomic leafs are inside the list
|
||||
// don't actually encode the list as json, though
|
||||
throw new Error(localize(
|
||||
'cannot send media,\nsprites or procedures\nto another scene'
|
||||
));
|
||||
if (message.canBeJSON()) {
|
||||
message = message.deepMap(leaf => leaf); // deep copy the list
|
||||
} else {
|
||||
throw new Error(localize(
|
||||
'cannot send media,\nsprites or procedures\nto another scene'
|
||||
));
|
||||
}
|
||||
}
|
||||
if (this.readyToTerminate) {
|
||||
// let the user press "stop" or "esc",
|
||||
|
|
Ładowanie…
Reference in New Issue