lua-users home
lua-l archive

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


On Tue, Dec 28, 2010 at 01:17:31PM +0200, Axel Kittenberger wrote:
> Would'nt it sufficide in the first part to increase just an integer instead?
> ---
> local n = 0
> for i, _ in ipairs(t) do
>     n = i
> end
> 
> for k, v in pairs(t) do
>    if type(k) ~= "number" or k<1 or k>n then
>       --- someting
>   end
> end
> 
No.

t={1,2}; t[1.5]=1.5

Dirk