libscratchcpp
libscratchcpp copied to clipboard
Add support for list references
It's possible to pass lists by reference in Scratch (https://scratch.mit.edu/projects/1048874723/). Since it's only possible with hacked blocks, there's no need for libscratchcpp to support it. However, it seems it's a feature and it should be implemented.
The reason for this is the data_listcontents block. It should return a list reference so that when, for example, a list monitor reads the data, it doesn't need to copy anything. This block is currently implemented to return the list index from the virtual machine and since the VM is going to be removed, this should change.
There's also a case where one puts this block into a project manually by editing the JSON. In this case the list reference should convert to string using List::toString() when assigning to a variable.