lua-users home
lua-l archive

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


> Now regarding my initial question, do you have any intuition regarding how much is missing for making Lua exception safe? Is it just
> some small detail that could be fixed with a small change, or does it require extensive reworking?

IIRC, if you compile Lua as C++ code, you should be careful when
"mixing" your own exceptions with Lua errors.

I am not sure what you mean by "exception safe". If you mean throwing
your own exceptions anywehre inside Lua and catching them anywhere
else, there is a lot missing. For instance, in the following code

  try {
    ...
    lua_call(...);
    ...
   } catch ...

an exception inside 'lua_call' will leave the Lua state in a mess.

For instance, a protected call in Lua will catch any exception inside
it; so, you should not throw to it exceptions in points where a Lua
error could not naturally occurr (e.g., inside the allocation function).

Similarly, any exception thrown by Lua (in an error or yield) expects
that Lua will catch that exception to correct its internal state.

-- Roberto