[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Recursion?
- From: "Thatcher Ulrich" <tu@...>
- Date: Wed, 5 Dec 2001 09:56:55 -0500
On Dec 05, 2001 at 08:43 -0600, John S. Miley wrote:
>
> 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
^^^^^^
did you really mean that? Doh! :)
> else
> print ("Savetab: "..i.."="..v)
> end
> end
> end
>
> savetab(mytab)
>
>
> I get the following for output:
>
> Savetab: a=1
> Savetab: ca=5
> Savetab: cc=9
> Savetab: cb=7
>
>
> Looks like it's stopping after the first nested table it encounters...any
> idea why?
See above...
--
Thatcher Ulrich <tu@tulrich.com>
http://tulrich.com