lua-users home
lua-l archive

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

William Roper wrote:

> Just a guess off the top of my head but:
> TRACE = function (x) 
> if(_G[x]) then
> print (x .. " : " .. _G[x])
> else
> print (x .. " : nil")
> end
> end
> then you would call it like so:
> foo = "bar"
> TRACE("foo")
> 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:
> >   cell: 760 214 2958