lua-users home
lua-l archive

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


2010/12/30 "J.Jørgen von Bargen" <jjvb.primus@gmx.de>
Am 30.12.2010 14:14, schrieb uki:

Please correct me if I'm wrong:
* if table has no holes # works
* if table has holes you don't know what # will return (it might return proper length or lenght of the first 'block' up till the first hole)
Do I understand this properly?
You missed one:
... or the last index of any fragment
[...] 

Thanks,

Then there is absolutely no way to check if the table has holes, except by iterating through the whole table.
So if you didn't create that table, you shouldn't use # on it.

I think I finally understand why everyone is so agitated by this issue. 
From a lua-newbie perspective, I think that it would be logical to have # throw an error when it can't return 'proper' length.

*Makes mental note to be _very_ carefull with using '#' *
--
Łukasz Gruner