[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Hooks for I/O, memory, etc?
- From: "J. Perkins" <jason@...>
- Date: Tue, 11 Jun 2002 14:39:50 -0400
Roberto Ierusalimschy wrote:
You don't have to hunt around the source code to change that. Inside
the libraries, each function stand for itself. For instance, "print"
uses the standard I/O facilities (OK, the manual doesn't say that); if
you don't want that, all you have to do is to define your own "print"
function. The manual explains how to do that (i.e. how to define your
Which means I have to:
- find the Lua implementation of the print() function. From memory,
I think it is luaB_print() in lbaselib.c. Not entirely intuitive.
Heck, the fact that I pulled that from memory shows how often
I've had to go through this.
- cut/paste your code into my own function...I want it to behave
the same way as the default implementation after all.
- make the changes to support my own fputs() function.
- pray you don't decide to change the default implementation. I'll
have to check every time you release new code, just to be sure.
It's not quite a trivial as "just define your own print function",
not if you want to do it right.