[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: RE: Recursion?
- From: "Peter Prade" <prade@...>
- Date: Wed, 5 Dec 2001 15:56:54 +0100
> mytab = {a = 1, b = 2, c = {ca = 5, cb = 7, cc = 9}, d = 3, e =
> {ea = 12, eb
> = {eea = 69, eeb = 72}, ec = 48}}
>
> function savetab(t)
> for i, v in t do
> if type(v) == "table" then
> savetab(v)
> return
> else
> print ("Savetab: "..i.."="..v)
> end
> end
> end
> Looks like it's stopping after the first nested table it encounters...any
> idea why?
Yes :-) have a look at the return statement...
you can also find useful stuff around tables on the wiki page at:
http://lua-users.org/wiki/PitLibTablestuff
Cheers,
Peter