Re: Getting local variable debug info from within a nested function.
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: Getting local variable debug info from within a nested function.
- From: "Sherry Zhang" <yuleopen@...>
- Date: 2007年6月17日 09:28:43 +0800
On 6/17/07, Matthew Armstrong <turkeypotpie@gmail.com> wrote:
This thing is pretty f*%#ing cool! Thanks for writing this. It has more
features, and is easier to use than what I was trying to do, so I'll
definitely be using this.
One small point: Is there a way to print a table? You can print the keys,
if you know them, but I didn't see a way of reflecting a table.
I have a special print function (called ppr), which prints the first level
keys if the variable happens to be a table. So I can say:
exec ppr(myVar)
This works ok for me, but I'm always looking for ways to lazyfy my typing.
On 6/13/07, Matthew Armstrong <turkeypotpie@gmail.com> wrote:
> Good deal. I'll just have to try it out then!
>
>
>
> On 6/13/07, Stefan Brantschen < sbr@acm.org> wrote:
> >
> > On 14 Jun 2007, at 07:56, Matthew Armstrong wrote:
> >
> > > Is there a way to run ldb within an embedded script?
> >
> > You can invoke ldb() at any location in the Lua code.
> >
> > With regards
> > -- Stefan
> >
> >
>
>
hi, here is one possible implementation.
function TableDump(atable, prefix, tablelevel)
prefix = prefix or ""
if tablelevel == nil then tablelevel = "" end
print(prefix.."-Dumping Table "..tablelevel, atable)
prefix = prefix.." "
local n = 0
for k, v in pairs(atable) do
n = n + 1
print(prefix..n..":", tablelevel.."["..k.."]", v)
if type(v) == "table" then
TableDump(v, prefix.." ", tablelevel.."["..k.."]")
end
end
end
- References:
- Getting local variable debug info from within a nested function., Matthew Armstrong
- Re: Getting local variable debug info from within a nested function., Sherry Zhang
- Re: Getting local variable debug info from within a nested function., Eduardo Ochs
- Re: Getting local variable debug info from within a nested function., Matthew Armstrong
- Re: Getting local variable debug info from within a nested function., Steve Heller
- Re: Getting local variable debug info from within a nested function., Stefan Brantschen
- Re: Getting local variable debug info from within a nested function., Matthew Armstrong
- Re: Getting local variable debug info from within a nested function., Stefan Brantschen
- Re: Getting local variable debug info from within a nested function., Matthew Armstrong
- Re: Getting local variable debug info from within a nested function., Matthew Armstrong