lua-users home
lua-l archive

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


Title: Question about error handling

Hello


I'm very new to LUA (about a week) and there is something I can not find out how to do.

I have succeeded to embed LUA in an application of mine and it all works fine. 
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. 

What I have is an application with an editor window in which the user types his script and then this script is run using lua_dostring.  When a syntax error or a runtime error is detected, I want to highlight the offending line in the editor.  But, as the only parameter to this error handling function seems to be the error message string, I wonder how to obtain the line number.

I could parse the message to get this information, but I don't think this is a clean aproach.


Any hints are welcome,

Frank De prins
Senior Software Engineer

MCS nv
Krugerstraat 121
B2660 Antwerp Belgium
Tel. +32.3.829.04.95