lua-users home
lua-l archive

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


On 2/16/06, Romulo Bahiense <romulo@icontroller.com.br> wrote:
> Er, I meant they don't provide a stack trace or anything.


Well, kind of. If your error handler honors __tostring metamethod ...

errtablemt = {
     __tostring = function(t)
         return string.format (
             'An error ocurred with error code %d: %s.\n%s',
             t.code,
             t.msg,
             debug.traceback()
         )
     end
}

Sort of but I was thinking more of the filename and line number that get prepended to the error message:

> error("error msg")
stdin:1: error msg

 Is there any way to get that information?  debug.traceback() doesn't seem to provide it.

--
// Chris