lua-users home
lua-l archive

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


> 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