lua-users home
lua-l archive

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


On Thu, Jan 22, 2009 at 7:30 PM, Asko Kauppi <askok@dnainternet.net> wrote:
>
> In regards to the discussion concerning non-string error values, there is a
> certain detail of Lua that in my opinion would deserve a change.
>
> The 'lua_pcall' function allows an error handler, which can grab the error
> message and modify it accordingly (normally, to add stack trace). This
> implies that the error "message" (as it is called in documentation) is a
> string. Non-string errors cannot be modified to have a stack trace.
>
> Why not allow an error handler return multiple values?  What I have in mind
> is two (error value + stack trace string). Currently, 'lua_pcall' silently
> eats up any additional return values from the error handler.

While we are considering the error handling as well, I wanted to
reiterate that a version of xpcall that allows us to pass arguments to
the function being called would be a welcome addition to Lua.  I
mention this here since it has obvious implications with the ability
to pass custom error handlers to xpcall.