lua-users home
lua-l archive

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

On 14/09/2006, at 8:06 AM, Roberto Ierusalimschy wrote:

local k= next(t)
while k ~= nil do
 t[k]= nil
 k= next(t)

It may be worth remembering that the above loop is quadratic in time.

-- Roberto

So is this (my original proposal) better/faster? ...

for k in pairs (t) do
  t [k] = nil
end -- for

- Nick