lua-users home
lua-l archive

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


On 05/07/2007 15:29, Luís Santos wrote:
Isn´t it confusing?

Confusing, perhaps, but it still have some logic...
This allows to manage hollow tables (few values scattered in a big range of indexes) efficiently, while managing full tables (almost all indexes having a value) efficiently too (numerical indexes instead of hashed ones). I believe that Lua is able to smartly switch from the first type to the second, which is a good thing. You can still pre-fill your array with 0s if you want your table to act like a classical array in most other languages.

--
Philippe Lhoste
--  (near) Paris -- France
--  http://Phi.Lho.free.fr
--  --  --  --  --  --  --  --  --  --  --  --  --  --