From 89a4fe410a33e6437686706ecd99f48a0a23676c Mon Sep 17 00:00:00 2001 From: jmoenig Date: Thu, 21 Oct 2021 12:04:58 +0200 Subject: [PATCH] enabled sending atomic lists to other scenes --- HISTORY.md | 1 + src/threads.js | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/HISTORY.md b/HISTORY.md index a6e73bc0..e4150c96 100755 --- a/HISTORY.md +++ b/HISTORY.md @@ -44,6 +44,7 @@ ### 2021-10-21 * threads, objects: make "when I receive 'any message'" hat scripts threadsafe (uninterruptable by other messages) +* threads: enabled sending atomic lists to other scenes ### 2021-10-20 * blocks: enable sending green-flag events when switching scenes diff --git a/src/threads.js b/src/threads.js index a59d8bba..a95ce905 100644 --- a/src/threads.js +++ b/src/threads.js @@ -4704,7 +4704,14 @@ Process.prototype.doSwitchToScene = function (id, transmission) { message = this.inputOption(transmission.at(1)), ide, scenes, num, scene; this.assertAlive(rcvr); - this.assertType(message, ['text', 'number']); + this.assertType(message, ['text', 'number', 'list']); + if (message instanceof List && !message.canBeJSON()) { + // make sure only atomic leafs are inside the list + // don't actually encode the list as json, though + throw new Error(localize( + 'can only send lists\nwith atomic data\nto another scene' + )); + } if (this.readyToTerminate) { // let the user press "stop" or "esc", // prevent "when this scene starts" hat blocks from directly