lua-users home
lua-l archive

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


for colnm, coltype in pairs(tb_columns) do
 -- do stuff with colnm and coltype
 
  if next(tb_columns, colnm) ~= nil then
    -- do stuff if this is the last iteration
  end
end

On Mon, May 4, 2009 at 5:05 PM, V S P <toreason@fastmail.fm> wrote:

Hello,
what's a way to anticipate the last iteration
in loop over a table

for colnm, coltype in pairs(tb_columns) do


I understand that I can get the table length, and then
increment a counter, but for some reason I thought
the table length thing was not reliable at all the cases...
but cannot find a reference to it

is there a better way?


thank you
--
 V S P
 toreason@fastmail.fm

--
http://www.fastmail.fm - A no graphics, no pop-ups email service