lua-users home
lua-l archive

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


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