Conversation
e3fa2f5 to
c931993
Compare
33472a9 to
f55ebc5
Compare
f55ebc5 to
868fb40
Compare
This commit adds the ability to run Go code when the game is running. No need to compile, and restart the game. Just write the code in terminal, hit enter, and it will be immediately executed. Go code is interpreted by traefik/yaegi interpreter. It is a Go interpreter compatible with standard Go compiler. Lines are read from terminal by peterh/liner package. For now I'm using my fork of github.com/peterh/liner, because the original does not work well in Goland/VSCode on Win11 (see peterh/liner#163). This is temporary, until peterh/liner is fixed properly. Limitations: * MidInt, MaxInt, MinInt - those functions can be executed in terminal but only accepts int's (not int64, byte etc.) * pi.Int cannot be used * The size of compiled game with devtools is increased by 3.7MB (+35% increase), the compilation takes 21% more time. But it is worth it. I plan to add a possibility to disable scripting in the future though.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds the ability to run Go code when the game is running. No need to compile, and restart the game. Just write the code in terminal, hit enter, and it will be immediately executed.
Go code is interpreted by traefik/yaegi interpreter. It is a Go interpreter compatible with standard Go compiler.
Lines are read from terminal by peterh/liner package. For now I'm using my fork of github.com/peterh/liner, because the original does not work well in Goland/VSCode on Win11 (see peterh/liner#163). This is temporary, until peterh/liner is fixed properly.
Limitations: