[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: A very basic thing I don't get
- From: joao lobato <btnfdp.lobato@...>
- Date: Wed, 5 Oct 2011 22:05:13 +0100
On 10/5/11, Luiz Henrique de Figueiredo <lhf@tecgraf.puc-rio.br> wrote:
>> Imagine you want to build a tree datastructure where you can store an
>> arbitrary Lua value per node. How does one accomplish such a goal
>> without instanciating a bunch of tables in the process?
>
> What is the problem with a bunch of tables?
>
>> Wouldn't a simple, fixed size, integer indexable (1 based, of course
>> ;-) ), array type be better suited for the role of building block?
>
> If you want Fortran, you know where to find it... :-)
> Plus Lua does very well on these arrays already...
>
>
Well, I believe you. Not having performed any benchmarking I wouldn't
argue about the overhead of the rest of the table implementation; it
was just a gut feeling :-)
It's just that sometimes I feel that it gets kind of convoluted to mix
userdata and the other Lua types because you have to jump a few hoops
if you want to, say, store a table in a C struct.
I'm ready to believe that, in those cases, I'm simply not doing it
"the Lua way (tm)" and that's the point of this thread that you summed
up spot on: there's how we do it and how others do it, and it's better
to learn the right way than to complain about it.
- References:
- A very basic thing I don't get, Thijs Koerselman
- Re: A very basic thing I don't get, Peter Cawley
- Re: A very basic thing I don't get, Stefan Reich
- Re: A very basic thing I don't get, Michal Kottman
- Re: A very basic thing I don't get, Stefan Reich
- Re: A very basic thing I don't get, Dirk Laurie
- Re: A very basic thing I don't get, Petite Abeille
- Re: A very basic thing I don't get, Lorenzo Donati
- Re: A very basic thing I don't get, Mark Hamburg
- Re: A very basic thing I don't get, joao lobato
- Re: A very basic thing I don't get, Luiz Henrique de Figueiredo