Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve Lua REPL handling of statements #4026

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kalimag
Copy link
Contributor

@kalimag kalimag commented Sep 8, 2024

Rework the way the Lua console REPL executes commands

The old way first tries to execute $"console.log({rawCommand})", which prints out the values of an entered expression, but results in a syntax error if the command is a statement such as foo = 1. If the first attempt errors, it executes the raw command without the log call, so the command still works, but it's printing out confusing syntax error messages anyway. If the expression itself causes an error like "a" + 1 or string.format("%error"), it tries to run it twice and prints out two different errors.

The PR changes it so LuaLibraries.ExecuteString attempts to first parse the modified command without running it, and then only executes either the modified command or the raw command. This avoids unnecessary error messages, double execution of certain commands etc.

Check if completed:

Stop printing syntax error messages when executing variable assignments etc.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant