I have searched a lot for it, but the answer can not be found anywhere. I am trying to do something like the following:
cat somefile.txt | Jeep Something Happen ./script.lua
I have not got a single resource to deal with pipe io in Luah, and how it will know how to do it. Is there any good way to do this, there is no way to deal with it? Preferably buffed for less memory usage, but I will arrange to read the entire file in one go if only one option.
It would be really disappointing to write it in a temporary file and then load it
The standard larari has a io.stdin
and a io.stdout
that you can use for the input and output without having to resort to temporary files. Are there. You can read io.read
isntead's someFile:
and it will be read by stdin by default.
The buffering is the responsibility of the operating system which is providing pipes.
Edit: Apparently when you used to mention buffering, you were thinking about reading part of the file, as opposed to loading the whole file. . Can take a numeric parameter to read a certain number of bytes from io.read
input, no character can be read while returning zero
.
local size = 2 ^ 13 - good buffer size (8a) while the local block = io.read (size) block is not, then the end io.write (block) breaks the end < / Code>
No comments:
Post a Comment