lua-users home
lua-l archive

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


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
own functions).

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.

Jason