lua-users home
lua-l archive

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


Unless I'm mistaken, this is automatic. row is no longer in scope once you break out of the loop.

Dave Collins
Front-End Engineer
Mercatus Technologies Inc.
60 Adelaide Street East, Suite 700
Toronto ON M5C 3E4
T  416 603 3406 x 298
F  416 603 1790

dave.collins@mercatustechnologies.com
www.mercatustechnologies.com

-----Original Message-----
From: lua-l-bounces@lists.lua.org [mailto:lua-l-bounces@lists.lua.org] On Behalf Of Antonio Vieiro
Sent: Tuesday, July 26, 2011 3:10 PM
To: lua-l@lists.lua.org
Subject: Cleaning up iterators

Hi all,

I'm thinking of using iterator to iterate over the results of a SQL 
query, something like:

for row in result("SELECT id,name FROM USER") do
   if row.id == 3 then break end
end

but I need to "clean-up" the iterator when it finishes (i.e. after the 
loop) or whenever I have a "break" or a "return" statement.

As far as I understand there's no way to do this, right?

Thanks in advance,
Antonio