lua-users home
lua-l archive

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

Hi there,
I just wrote a TRY..CATCH extension for Lua, and adapted it into version 5.1.3. The
syntax is like this:
      ... (block) ...
If error occurs in the block, the control immediately jumps to the first statement after END, and
the error will be ignored.
another form,
        ... (block) ...
    catch err do
        ... (handler) ...
Where  err is a variable local to the handler block, which holds the error object thrown in error(),
then we can handle the error object in handler block.
Traditional pcall() and xpcall() behavior is intact. You can nest pcall() and try..catch as you want.
The difference is, you can call coroutine.yield() (or lua_yield in C) in try..catch block. The implementation
is platform independent. It uses setjmp...longjmp mechanism so it may not be quite compatible with
I'm new to the mailing list, Could anyone tell me how and where to post the patch, or just attach
it in the mail? Thanks.