lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Thu, Feb 24, 2022 at 11:09 PM Roberto Ierusalimschy wrote:
> [1/4] Add -u flag to interpreter. Forces unbuffered standard streams.

You can define a file 'u.lua' in your path with this code:
 io.stdin:setvbuf("no")
 io.stdout:setvbuf("no")
 io.stderr:setvbuf("no")
Once you do that, you now have a two-letter flag "-lu".

I'd like to have an option to reopen stdin/stdout in binary mode.
It is currently impossible from Lua code.
So, Lua scripts are unable to process and generate binary input/output on Windows.
Other programs (written on C) read/write binary data in stdout/stdin,
but the "lua.exe myscript.lua" process can not be piped to them.

It would be useful for "lua.exe" to have an option to force unbuffered binary standard streams.
It does not matter how many letters it would consist of.