lua-users home
lua-l archive

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


Hi,

My program prints stuff to the console. Most of the time I use just print(), but in some cases I prefer to use io.write() and io.flush(), for example to show progress on an operation. The problem is that, when I do, the Lua script won't run anymore if not executed from a terminal. At any rate, there's little point in showing stuff in the terminal if it's not visible, so I suppose I would need to set the standard output to a file. So how can I determine if the script is run from a terminal or not?

I use LuaJIT on Kubuntu Linux, if that matters.

Thanks in advance

Ralf