lua-users home
lua-l archive

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


On Wed, Jul 13, 2011 at 16:42, Patrick Donnelly <batrick@batbytes.com> wrote:
> Use debug.getinfo to see if your replacement print function is being called
> from the first function on the call stack (the interpreter). It would look
> like:
>
> if debug.getinfo(3) == nil then
>   -- interpreter
> else
>   -- normal
> end

You might also play with the LUA_INIT environment variable. This is
used by both the interpreter and the interactive prompt, but from
there you can do things like define your own prettyprint() in a
startup script, and just do print=prettyprint whenever you start the
prompt. There are also command-line options you can use to similar
effect.

-- 
Sent from my toaster.