lua-users home
lua-l archive

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


It looks as though Lua's io package is hardwired to use the ANSI stdio library. The reference manual says "a file handle is a userdata containing the file stream (FILE*)..." [5.6] There doesn't seem to be a way to 'subclass' file handles the way I could e.g. subclass java.io.OutputStream.

What I want to do is redirect Lua output to my own function, so that calls to print(), io.write(), io.output():write(), etc. all call my function so it can collect the output and do something with it.

(Apologies if I'm missing something obvious; I've used a lot of languages but I'm a newbie at Lua.)

--Jens