First of all, I understand this is somewhat useless. I do know that there are other ways of going about this. This isn't something I'm really want to do and more of something I want to know.
So, let's say you're making a custom block. And you want the custom block to return a nested reporter block from a string. So you would give the block the string "^+*", and it would return
Once again, I understand this is completely and utterly pointless, you could just give it a string like "3^2+4*85" and then have calculate 3^2 and 4*85, then add 9 and 340 together, sending the output. If you were a mad lad you could just use the dangerous eval() function. So if you have anything better to do, I'm fine with that.
The reason I'm asking this question is because it is possible. You'd probably have to use objects and functions created for the inner workings of snap, but that's why I chose this topic. Also, I've only been a programmer recently, so I think the answer to this question would help me learn. But the main reason is it would be interesting to know.
What I've tried:
First thing that I tried was:
Now I'm sure why this didn't work, but I'm going to guess it's because it's running with the rings:
instead of without them. Next, I tried this:
And then:
And finally:
and then I gave up.
I tried looking at the code for snap, mainly block.js and object.js, but I couldn't figure out how to return a block like the ring block does internally. Thanks in advance!