lua-users home
lua-l archive

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


On Tue, Nov 8, 2011 at 5:36 AM, HyperHacker <hyperhacker@gmail.com> wrote:
> Is an alert something that can be caught with pcall? That seems like
> the most sensible way for an iterator to handle errors.

Of course, but you have to know that this corner case can throw an error.

It would be possible to wrap the lines() method in an iterator that uses pcall.

for line in safe(f:lines()) do .. end

steve d.