Frequently when sending a message to a component one would like to attach multiple values and not just one and Protopie doesn’t provide any obvious way to do this. However, it is possible to use parseJson to achieve a similar effect. If you concatenate your elements together as a string, with elements separated by commas and bookended by square brackets. For example, pass “[“+4+”,”+7+”,”+11+”,”+19+”]” as the value attached to your message.
When the message is received pass the value to a temporary variable and extract the values using parseJson – remember that it uses 0 to n-1 as keys. Thus, if the variable source contains “[4,7,11,19]” then parseJson(source, 3) will return 19.
You can see an example of this in this radio button pie where I use an array containing three values when a button is tapped. – passing identity, set and status back to the scene from the component.
One limitation is that there aren’t functions to give you the length of the array (for example).
And, even more constraining for some usage, it isn’t possible (at least in any straightforward way) to assign into a cell of an array this way.