[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Please translate this easy snip of C++ to Lua
- From: Ben Sunshine-Hill <sneftel@...>
- Date: Wed, 8 Dec 2004 15:49:45 -0800
Edit: heh, just realized the problem with that. nevermind.
On Wed, 8 Dec 2004 15:48:38 -0800, Ben Sunshine-Hill <sneftel@gmail.com> wrote:
> Untested:
>
> function trace(x)
> print(debug.getlocal(1, 1), x)
> end
>
>
>
>
> On Wed, 8 Dec 2004 14:47:50 -0800, Philip Plumlee
> <phlip@sammystudios.com> wrote:
> > Luists:
> >
> > Ogle this awesome snip of C++:
> >
> > #define TRACE_(x) cout << #x ": " << x << endl
> >
> > When you use that like this...
> >
> > TRACE_(y + z);
> > TRACE_(strAnimals);
> > TRACE_(__LINE__);
> >
> > ...the program emits this:
> >
> > y + z: 12
> > strAnimals: Lemmings
> > __LINE__: 69
> >
> > Mighty healthy and easy to write debug statements with, huh? Saves a lot
> > of keystrokes, huh?
> >
> > How do I do that, just as easy to call (meaning without extra "" quotes
> > or anything), in Lua?
> >
> > --
> > Phlip
> > http://ssw0251/wiki.rb?RecentChanges
> > home: mailto:phlip2005@gmail.com
> > cell: 760 214 2958
> >
>