In C you have isatty(file_descriptor)
and you can pass 0 as the file descriptor for STDIN and 1 for STDOUT.
How can I assert that in Lua?
I don't know of anything built-in but you could always shell out for a test with [
or tty
(obviously somewhat non-portable) if you didn't want to use a C module that exposed isatty
.
C modules that expose isatty
:
there are probably others too.