lua-users home
lua-l archive

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


Hi,

> I'm having a problem with a library I made for Lua 4.0 beta.
> Everything does what I expected it to do, but when I try to
> use write() or print() from the Lua code, nothing is actually
> output until the program exits. It will also show the output
> after I call a printf() from one of my library functions.

I had no look at you lib but this sounds like the file descriptor
you are writing to is not connected to a tty or the buffering
of it has been changed to fully buffered.  stdio functions buffer
data.  If the fd is in line buffered mode (default for tty-fds)
it emits the data if a \n is seen.  In full buffered (default for
anything else) it waits until the buffer is really full (1-4kb).

And, the buffer is of course flushed when the program exits...

Ciao, ET.