[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [ANN] Lua 5.2.0 (alpha) now available
- From: Roberto Ierusalimschy <roberto@...>
- Date: Tue, 16 Nov 2010 14:01:09 -0200
> Consider the following code. I expect it to print "bad" once, but it
> does so many times. The manual is a little unclear, but seems to
> imply that xpcall(f, err) only puts f in protected mode. It shouldn't
> catch errors in err. Does that make sense? [...]
It may make sense for the particular case of xpcall, but this behavior
comes from the more primitive lua_pcall, and it is difficult to change
one without changing the other.
For lua_pcall, this behavior seems better than the alternative (to
raise errors from 'err'). It ensures that lua_pcall never raises
an error.
-- Roberto