Closed agjaeger closed 10 years ago
You can use this answer from stackoverflow
var code = editor.getSession().getValue();
You can implement this, for example, by editing a line in the example gist in the function runit()
:
// Original code
var prog = document.getElementById("yourcode").value;
// Using Ace Editor
var prog = editor.getSession().getValue();
Currently, Skulpt pulls code from the editor div, however after trying to use Ace as a text editor, Skulpt was unable to load the new code into the interpreter
In order to fix problem, I feel it might be necessary to create a temporary div that JS can pull the code from the editor, place it in the temp div and then Skulpt can interpret it and output the result to the output div.
As a quick fix, a text area has replaced Ace, as it allows Skulpt to pull its contents as the run button is pressed. I recommend modeling Ace after the text area with the temporary div.