lua-users home
lua-l archive

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


On 29/06/2011 18:15, Dirk Feytons wrote:
for k,v in pairs(t) do
   t[k] = nil
   if (<some condition>) then
     t[k] =<some other value>
   end
end

Unless I am missing something (maybe the real code is much more complex), you can rewrite it as:

for k, v in pairs(t) do
  if (<some condition>) then
    t[k] = <some other value>
  else
    t[k] = nil
  end
end

no?

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