lua-users home
lua-l archive

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


On Fri, Oct 19, 2012 at 11:01 PM, Patrick Donnelly <batrick@batbytes.com> wrote:
> On Fri, Oct 19, 2012 at 11:43 PM, Rena <hyperhacker@gmail.com> wrote:
>> I've been working with a system that expects me to output binary data
>> to stdout, and I realized it'd be a good idea to replace print() with
>> a function that writes to some other file (stderr seems like a good
>> choice) so that it can still be used for debugging.
>
> I don't think print was every intended for debugging. There's also
> nothing magical about it...
>
>> The problem that occurs to me is that print() does a bit of magic to
>> align things nicely to columns (it looks more complex than just
>> appending a tab to everything?) and I'm not sure how that works.
>
> http://www.lua.org/source/5.2/lbaselib.c.html#luaB_print
>
> Leave print alone and make a custom log function? There are many
> logging libraries in the wild to hunt for.
>
> --
> - Patrick Donnelly
>

Well, the main concern is that I'll be calling user-provided code,
which might naively call print() or load a module that uses print()
for debug output.

-- 
Sent from my Game Boy.