Re: [Q] how to anticipate last iteration in for .. in pairs
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: [Q] how to anticipate last iteration in for .. in pairs
- From: Kristofer Karlsson <kristofer.karlsson@...>
- Date: Mon, 4 May 2009 17:09:30 +0200
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