lua-users home
lua-l archive

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

Hi everyone,

While all this conversation about the C-part is really interesting, my original concern was using plain Lua.

Without a way of specifying/altering the traceback when raising an error, the "error recuperation + cleanup + bubbling up" strategy means either losing the traceback information or altering the error significantly (i.e. changing it to a table, and adding a traceback field inside it)

I'm sure this problem can be solved by using C, but I'd be much more interested in finding a plain Lua solution, if possible. 

The best I could do was proposing adding a second parameter to error: error(msg, traceback) <- traceback replaces or is chained to the error traceback.

What are your thoughts on that?

Thanks a lot,

Enrique (@otikik)

On Mon, Sep 23, 2013 at 4:32 PM, Roberto Ierusalimschy <> wrote:
> [...] AFAIK, VM errors are flattened to a string via luaL_error/luaG_runerror before reaching a user-overridable error callback.

Both luaL_error/luaG_runerror receive only strings, so they do not
need to flatten anything. But the real error primitive is lua_error
and, internally, luaG_errormsg; both accept any object as the
error "message" and do not change that object in any way.

-- Roberto