|
On 1 Dec '05, at 3:15 PM, Javier Guerra wrote:
OK. Then my next question is, what are the core bottlenecks that output goes through? In other words, what's the minimal set of functions I have to replace? There seem to be many different ways to write to stdout: print() io.write() io.output():write() io.stdout():write() From the reference, it looks like print() calls io.stdout():write(), and io.write() calls io.output:write().
Would it work to create my own 'object' (table) and add a 'write' method to it, then make that the default output file? That sounds like it should work, unless there is code inside the Lua VM that knows that files are userdata and gropes the FILE* pointers out of them. Something like: myout = { write = function(self,str) ..... end } io.output(myout) print("hello world") --Jens |