Compile text using command line compiler, not a file
I'm using luac -p file.lua
to parse files to check for syntax errors. Is it possible to do something like this:
luac -p | [a bunch of text]
Someone mentioned something about 'piping' but I couldn't figure out how that would help.
What I'm wanting to do is take text from a program I am writing and put all that text into the compiler with -p
so it just parses the text. Basically I want to check syntax of my program's textarea without having to write it to a file first.
command-line compilation lua
migrated from superuser.com Jan 26 at 17:24
This question came from our site for computer enthusiasts and power users.
add a comment |
I'm using luac -p file.lua
to parse files to check for syntax errors. Is it possible to do something like this:
luac -p | [a bunch of text]
Someone mentioned something about 'piping' but I couldn't figure out how that would help.
What I'm wanting to do is take text from a program I am writing and put all that text into the compiler with -p
so it just parses the text. Basically I want to check syntax of my program's textarea without having to write it to a file first.
command-line compilation lua
migrated from superuser.com Jan 26 at 17:24
This question came from our site for computer enthusiasts and power users.
Are you using Windows command line for this? If so you can loop it like sofor %a in ("C:Folder*.lua") do luac -p | "%~a"
....
– Bitcoin Murderous Maniac
Jan 26 at 16:16
c:folder*.lua seems to refer to a file. I'm trying to compile text without a file - maybe from the clipboard or just adding all the text into the command prompt. I'm doing this from java Process execution. (also a side note, I'm hoping to get this working with mac and windows)
– tproper
Jan 26 at 16:21
2
Yes,luac
accepts program from stdin:luac -p -
So, just runcat program.lua | luac -p -
– Egor Skriptunoff
Jan 26 at 18:26
Not sure how that works... what is program.lua? remember, I have no file, it's text going into the terminal.
– tproper
Jan 27 at 19:17
add a comment |
I'm using luac -p file.lua
to parse files to check for syntax errors. Is it possible to do something like this:
luac -p | [a bunch of text]
Someone mentioned something about 'piping' but I couldn't figure out how that would help.
What I'm wanting to do is take text from a program I am writing and put all that text into the compiler with -p
so it just parses the text. Basically I want to check syntax of my program's textarea without having to write it to a file first.
command-line compilation lua
I'm using luac -p file.lua
to parse files to check for syntax errors. Is it possible to do something like this:
luac -p | [a bunch of text]
Someone mentioned something about 'piping' but I couldn't figure out how that would help.
What I'm wanting to do is take text from a program I am writing and put all that text into the compiler with -p
so it just parses the text. Basically I want to check syntax of my program's textarea without having to write it to a file first.
command-line compilation lua
command-line compilation lua
edited Jan 26 at 18:24
Egor Skriptunoff
17.3k12554
17.3k12554
asked Jan 26 at 15:42
tpropertproper
83
83
migrated from superuser.com Jan 26 at 17:24
This question came from our site for computer enthusiasts and power users.
migrated from superuser.com Jan 26 at 17:24
This question came from our site for computer enthusiasts and power users.
Are you using Windows command line for this? If so you can loop it like sofor %a in ("C:Folder*.lua") do luac -p | "%~a"
....
– Bitcoin Murderous Maniac
Jan 26 at 16:16
c:folder*.lua seems to refer to a file. I'm trying to compile text without a file - maybe from the clipboard or just adding all the text into the command prompt. I'm doing this from java Process execution. (also a side note, I'm hoping to get this working with mac and windows)
– tproper
Jan 26 at 16:21
2
Yes,luac
accepts program from stdin:luac -p -
So, just runcat program.lua | luac -p -
– Egor Skriptunoff
Jan 26 at 18:26
Not sure how that works... what is program.lua? remember, I have no file, it's text going into the terminal.
– tproper
Jan 27 at 19:17
add a comment |
Are you using Windows command line for this? If so you can loop it like sofor %a in ("C:Folder*.lua") do luac -p | "%~a"
....
– Bitcoin Murderous Maniac
Jan 26 at 16:16
c:folder*.lua seems to refer to a file. I'm trying to compile text without a file - maybe from the clipboard or just adding all the text into the command prompt. I'm doing this from java Process execution. (also a side note, I'm hoping to get this working with mac and windows)
– tproper
Jan 26 at 16:21
2
Yes,luac
accepts program from stdin:luac -p -
So, just runcat program.lua | luac -p -
– Egor Skriptunoff
Jan 26 at 18:26
Not sure how that works... what is program.lua? remember, I have no file, it's text going into the terminal.
– tproper
Jan 27 at 19:17
Are you using Windows command line for this? If so you can loop it like so
for %a in ("C:Folder*.lua") do luac -p | "%~a"
....– Bitcoin Murderous Maniac
Jan 26 at 16:16
Are you using Windows command line for this? If so you can loop it like so
for %a in ("C:Folder*.lua") do luac -p | "%~a"
....– Bitcoin Murderous Maniac
Jan 26 at 16:16
c:folder*.lua seems to refer to a file. I'm trying to compile text without a file - maybe from the clipboard or just adding all the text into the command prompt. I'm doing this from java Process execution. (also a side note, I'm hoping to get this working with mac and windows)
– tproper
Jan 26 at 16:21
c:folder*.lua seems to refer to a file. I'm trying to compile text without a file - maybe from the clipboard or just adding all the text into the command prompt. I'm doing this from java Process execution. (also a side note, I'm hoping to get this working with mac and windows)
– tproper
Jan 26 at 16:21
2
2
Yes,
luac
accepts program from stdin: luac -p -
So, just run cat program.lua | luac -p -
– Egor Skriptunoff
Jan 26 at 18:26
Yes,
luac
accepts program from stdin: luac -p -
So, just run cat program.lua | luac -p -
– Egor Skriptunoff
Jan 26 at 18:26
Not sure how that works... what is program.lua? remember, I have no file, it's text going into the terminal.
– tproper
Jan 27 at 19:17
Not sure how that works... what is program.lua? remember, I have no file, it's text going into the terminal.
– tproper
Jan 27 at 19:17
add a comment |
1 Answer
1
active
oldest
votes
In bash you can do
luac -p - << EOF
Then type your text. To indicate end, just type
EOF
on new line and press enter.
I triedluac -p - << print("Hello) n EOF
and it just starts luac or something and doesn't return the error which is the missing " in that text.
– tproper
Jan 27 at 19:19
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54380814%2fcompile-text-using-command-line-compiler-not-a-file%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
In bash you can do
luac -p - << EOF
Then type your text. To indicate end, just type
EOF
on new line and press enter.
I triedluac -p - << print("Hello) n EOF
and it just starts luac or something and doesn't return the error which is the missing " in that text.
– tproper
Jan 27 at 19:19
add a comment |
In bash you can do
luac -p - << EOF
Then type your text. To indicate end, just type
EOF
on new line and press enter.
I triedluac -p - << print("Hello) n EOF
and it just starts luac or something and doesn't return the error which is the missing " in that text.
– tproper
Jan 27 at 19:19
add a comment |
In bash you can do
luac -p - << EOF
Then type your text. To indicate end, just type
EOF
on new line and press enter.
In bash you can do
luac -p - << EOF
Then type your text. To indicate end, just type
EOF
on new line and press enter.
answered Jan 27 at 12:23
valval
379619
379619
I triedluac -p - << print("Hello) n EOF
and it just starts luac or something and doesn't return the error which is the missing " in that text.
– tproper
Jan 27 at 19:19
add a comment |
I triedluac -p - << print("Hello) n EOF
and it just starts luac or something and doesn't return the error which is the missing " in that text.
– tproper
Jan 27 at 19:19
I tried
luac -p - << print("Hello) n EOF
and it just starts luac or something and doesn't return the error which is the missing " in that text.– tproper
Jan 27 at 19:19
I tried
luac -p - << print("Hello) n EOF
and it just starts luac or something and doesn't return the error which is the missing " in that text.– tproper
Jan 27 at 19:19
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54380814%2fcompile-text-using-command-line-compiler-not-a-file%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Are you using Windows command line for this? If so you can loop it like so
for %a in ("C:Folder*.lua") do luac -p | "%~a"
....– Bitcoin Murderous Maniac
Jan 26 at 16:16
c:folder*.lua seems to refer to a file. I'm trying to compile text without a file - maybe from the clipboard or just adding all the text into the command prompt. I'm doing this from java Process execution. (also a side note, I'm hoping to get this working with mac and windows)
– tproper
Jan 26 at 16:21
2
Yes,
luac
accepts program from stdin:luac -p -
So, just runcat program.lua | luac -p -
– Egor Skriptunoff
Jan 26 at 18:26
Not sure how that works... what is program.lua? remember, I have no file, it's text going into the terminal.
– tproper
Jan 27 at 19:17