lua-users home
lua-l archive

"Redirecting" stdout, stderr

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


Hello Lua gurus :-)
I would like to know if it is possible to replace
standard output and error streams in Lua, in
order to redirect output from Lua internals and
from Lua scripts.
Ideally I would like to provide my own functions
for displaying results from Lua calls.
Does someone know how to achieve this ?
Is it possible to keep Lua core librairies "as is", or
do I have to change the implementation (e.g replacing
"fprintf" etc. by my own functions ?)
In Python it is sufficient to reassign to sys.stdout or
stderr a file-like object ; is it the same in Lua with
io.stdout ? Does it work in all cases ?
Thanks in advance for your help,
Matias.

AltStyle によって変換されたページ (->オリジナル) /