lua-users home
lua-l archive

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


>After some searching, I have also succeeded in installing a custom
>error handler function, but I do not succeed in finding out how to
>obtain the line number of the error for which the function gets called.

If your error handler is in Lua, try something like this:

function _ERRORMESSAGE(s)
 print(s)
 local a=getinfo(2)
 print(a.short_src,a.currentline,a.name)
end

If it is in C, you'll have to call lua_getstack and then lua_getinfo.
--lhf