[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: RE: Please translate this easy snip of C++ to Lua
- From: "Philip Plumlee" <phlip@...>
- Date: Wed, 8 Dec 2004 16:20:09 -0800
William Roper wrote:
> Just a guess off the top of my head but:
> TRACE = function (x)
> if(_G[x]) then
> print (x .. " : " .. _G[x])
> print (x .. " : nil")
> then you would call it like so:
> foo = "bar"
> I'm not sure how to get the name of the parameter, which is
> why the "'s are needed there.
For Python and Ruby, one bypasses the "" marks by reading the file above
the current location in the call stack, and parsing the line containing
Don't worry about Lua, because I can't control the embedding. (Did I
mention this Lua is embedded in C++?;) So I won't be able to do an
end-run around the embedding context.
I will get by with the "" marks for now; thanks!
For C++, I use this very useful snip of code on people who have read too
many /Effective/ books, and who shriek at any use of the preprocessor.
My goal is assertions, like for CppUnit or JUnit, that reflect their
argument sources into their output streams.
> > --
> > Phlip
> > http://ssw0251/wiki.rb?RecentChanges
> > home: mailto:firstname.lastname@example.org
> > cell: 760 214 2958