[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Problems with bubbling up tracebacks in Lua (& proposed solution)
- From: petah <lua@...>
- Date: Mon, 23 Sep 2013 15:39:06 +0200
On Sun, 22 Sep 2013 10:54:28 -0300
Luiz Henrique de Figueiredo <lhf@tecgraf.puc-rio.br> wrote:
> > By the time you intercept a native Lua error it's already converted to a string by the Lua VM, so you don't need to handle another data type...
>
> The Lua VM does not convert error values to string.
Is this true beyond the 7 high-level LUA_xxx integer error identifiers? AFAIK, VM errors are flattened to a string via luaL_error/luaG_runerror before reaching a user-overridable error callback.
If this string conversion were deferred, say by encapsulating the error arguments (currently passed to lua_pushvfstring/luaO_pushvfstring) inside an error object, it'd give a user-installed error callback "raw" data to base logic on. Adding a __tostring metamethod to this error object (table) would seem to preserve the current behavior.
A unique error identifier would be great but could also be inferred from the vararg's fmt.
my 2 cents.
-- p