lua-users home
lua-l archive

Re: pairs(t, skey) and ipairs(t, skey)

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


2013年10月4日 Schmidt, Phil <PSchmidt@watlow.com>
"A sequence in Lua has no holes and # returns the number of elements in a sequence."


Does not the example below contradict the statement above? If not, then why not?



Lua 5.2.2  Copyright (C) 1994-2013 Lua.org, PUC-Rio
> a={'a','b','c','d'}
> print(#a)
4
> for k,v in ipairs(a) do print(k,v) end
1       a
2       b
3       c
4       d
> a[3]=nil

"A sequence in Lua has no holes". If you make a hole it's not a sequence any more.

-- Fidelis

AltStyle によって変換されたページ (->オリジナル) /