[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Simple question about traversing a table
- From: Christophe Jorssen <jorssen.leraincy@...>
- Date: Tue, 21 Jun 2011 16:16:00 +0200
2011/6/21 James Graves <james.c.graves.jr@gmail.com>:
>
> There's a few things wrong with that function. Here's the corrected
> version (of what I think you intended):
>
> function traverse_table(t)
> if t and type(t) == "table" then
> for k=1,#t do
> if type(t[k]) == "table" then
> print("a table")
> traverse_table(t[k])
> else
> print("not a table")
> end
> end
> else
> print("not a table")
> end
> end
>
Arg... I told you it was a silly question :-)
Thank you all for your quick answers.
Best,
--
Christophe