WebAssembly runtime for Python, Lua, Ruby and etc.
Select your programming language from the menu in the bottom right corner.
Edit your code in the editor.
Set the input to standard input in the input box at the bottom.
Click the RUN button or press Ctrl + S to run the code.
Click the CLEAR button or press Ctrl + L to clear the terminal.
Click the SHARE button to generate and copy the share link.
1<html> 2 <body> 3 <!-- Create a element to display output --> 4 <pre id="output"></pre> 5 <script type="module"> 6 // Load module 7 import lua from "https://shift.js.org/wasm/lua.js"; // interpreter runtime 8 import makeConfig from "https://shift.js.org/wasm/common.js" ; // interpreter config 9 10 // the code to run 11 const code = "print('hello')"; 12 13 // callback to get result 14 const fn = (text) => document.querySelector("#output").innerText = text; 15 16 // run the code 17 lua(makeConfig(code, fn)); 18 </script> 19 </body> 20</html>
<iframe>1<html> 2 <body> 3 <!-- iframe to display shift --> 4 <iframe id="code" title="Shift" style="width: 100%; height: 600px; border: 0;"></iframe> 5 6 <script> 7 const lang = 'lua'; // language 8 const input_text = ''; // data of STDIN 9 const code_text = 'print("hello")'; // code to run 10 11 // generate URL 12 const input = encodeURIComponent(btoa(encodeURIComponent(input_text))); 13 const code = encodeURIComponent(btoa(encodeURIComponent(code_text))); 14 const url = `https://shift.js.org/#lang=${lang}&input=${input}&code=${code}`; 15 16 // set iframe src 17 document.querySelector("#code").src = url; 18 </script> 19 </body> 20</html>