[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Recursion?
- From: Reuben Thomas <rrt@...>
- Date: Wed, 5 Dec 2001 14:54:30 +0000 (GMT)
> 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
It's this return that's the problem: it's stopping as soon as the first
subtable has been dealt with, as you say! Just remove it.
Then I get:
Savetab: a=1
Savetab: ca=5
Savetab: cc=9
Savetab: cb=7
Savetab: b=2
Savetab: eea=69
Savetab: eeb=72
Savetab: ea=12
Savetab: ec=48
Savetab: d=3
which looks about right.