Skip to content

Commit

Permalink
fix: JS stdin lineno
Browse files Browse the repository at this point in the history
  • Loading branch information
vinceh121 committed Oct 5, 2023
1 parent efd03e0 commit 17c3330
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion core/src/me/vinceh121/wanderer/ConsoleHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,12 @@ private void run() {
new JsGame(this.game).install(this.scope);
this.fillConsoleScope(this.scope);

int lineNo = 1;

while (!this.closed) {
try {
final String line = this.lineReader.readLine("Wanderer> ");
final Object res = this.jsContext.evaluateString(this.scope, line, "<stdin>", -1, null);
final Object res = this.jsContext.evaluateString(this.scope, line, "<stdin>", lineNo++, null);
System.out.println(ScriptRuntime.toString(res));
} catch (final EcmaError e) {
ConsoleHandler.LOG.error("", e);
Expand Down

0 comments on commit 17c3330

Please sign in to comment.