aroberge / reeborg

Enhanced Karel-the-robot clone
http://reeborg.ca/reeborg.html
Other
47 stars 36 forks source link

simple set_programming_language #347

Closed aroberge closed 7 years ago

aroberge commented 7 years ago

Right now, if we want to have a world use Python as a programming language, but allow input from blockly or the repl as well as the editor, we have to write the following in the onload editor:

// Since Python code is included in the
// pre and post editors, we need to ensure
// that Python is set as the programming language.
if (!(RUR.state.input_method == "py-repl" ||
    RUR.state.input_method == "python" ||
    RUR.state.input_method == "blockly-py")) {
    RUR.onload_set_programming_mode("python");
}

This should be replaced by a single call:

RUR.onload_set_programming_language("python");

with a similar choice for "javascript".