lua-users home
lua-l archive

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


Hi,
     I see that if there is an error in the message handler then the program gets stuck and results in a stack overflow. For example:

function f ()
    local y= "a" +   2  -- will cause error
end -- f

function err (x)
    print("err called", x)
    error("Inside message handler")
    return x
end -- err
print (xpcall (f, err))

So if there is a message handler which may throw an error in case of something unexpected then is there any way to control this. One way would be to wrap the message handler inside your own handler and check the stack using the debug library. Is there a better way to do this?

Thanks,
Milind