lua-users home
lua-l archive

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


>> Too bad Lua doesn't use its own error() model to throw an error object/table before flattening it to a string.
>
>You can throw any Lua value with lua_error() or error(), but I guess
>you mean that internally the Lua core could thrown something else.

Btw I'm not advocating an overhaul of Lua's error handling -- I cherish Lua's consistency/compatibility like any long-time user -- and understand a declarative struct/table covering all possible lua core errors may be "uma bagunça".

The current challenge, as I see it, is that LUA_ERRSYNTAX/LUA_ERRRUN cover too many different error types. If Lua could set a unique error enum from the error-triggering function (retrievable from the registry, a new lua_substatus() function or whatever), extracting info from a flattened error string would be reasonably safe. 

thx,

-- p