lua-users home
lua-l archive

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


Jacek Czerwinski wrote:

How can I trap error, get filename, line, maximum of infos - BEFORE
error message is formatted into string.

Analyzing the error string isn't too much 'profi'...

I CAN use (and replace) _ALERT but _ALERT is too late.
AFAIK Lua always creates this string - you cannot change this without changing Lua code. But as I see only functions from lauxlib.c uses _ALERT - if you don't need it you can rewrite callalert() - for example into function which throws C++ exceptions - and recompile Lua with modified lauxlib.c. In the exception you can use lua_getstack() and lua_getinfo() (see manual) to get filename, line etc. without parsing.

--
Adam -Nalfein- Dziendziel,
Poland