Skip to content

Commit

Permalink
Patch lua print function to js console output
Browse files Browse the repository at this point in the history
  • Loading branch information
sansmoraxz committed May 17, 2024
1 parent 5e2eb03 commit a957940
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/CodeEditorWindow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ const CodeEditorWindow = ({ language }: CodeEditorWindowProps) => {
try {
const engine = await factory.createEngine();

// override print function to use console.log
engine.global.set("print", (...args: unknown[]) => {
console.info("Lua Console output: ", ...args);
});


try {
const output = await engine.doString(srCode);
if (output) {
Expand Down

0 comments on commit a957940

Please sign in to comment.