What is the "context >>" code called and how to turn it into blocks?

I would like to be able to turn context code back into blocks, but split doesn't work.
Context >> a CommandBlockMorph ("pen down...") a VariableFrame {}

There's no way to convert it to a block without writing a program to parse the text and grabbing the block from a table.

?

Table = lists inside a list

You can't really turn it into blocks. Context strings don't contain all the necessary information.
Just use [scratchblocks]split({script::motion}@addInput::grey ring)by(blocks v)::operators reporter[/scratchblocks]

I want to store blocks and scripts in text form for your browser, but I can't just use regular blocks.

why doesn't split work for you?

split the code by what?

I tried all of them

blocks, of course!

split context << code just gives me an error when splitting it into blocks. Also, just splitting blocks gives me a list of block, but I cant store that in broswer

no, you split the Context by blocks to get the syntax tree. And then you encode that as text.

image

@jens I see what you mean now, but how do I encode it into text?
(sorry)

Use a table to convert the blocks into text, then just JSON OF the list.

righto!

oh God, okay

I've actually made a project to do that both ways. (block->JSON and JSON->block) Here. (you have to explicitly JSON OF it, but I have an example in the project) (Oh and if you want to map the blocks, you have to have JS on, but only for mapping them to their selectors, or, if they're custom blocks, a list of "evaluateCustomBlock" and the selectors.)

ok

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.