lua-users home
lua-l archive

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


mark greenlancer wrote:
I use lua embedded in a c++ program.
I compile lua with my programm and everything works fine.

But e.g. I have a syntax error lua interrupt it's work and
returned to my programm (on dofile). I've set the 'atpanic' callback
function - but how to get more info about the error
(like line no., kind of error (syntax,...))?

I can't see the relation with the thread, but perhaps you are new here too... You should make new messages (not reply) and take a signifiant subject.

I believe you should take a look at src/lua/lua.c which is the official interpreter of the language. It can be seen also as a program managing command line parameters and interactive mode, embedding Lua, just like your.

Look how it manages scripts: if Lua meets an error, it reports it with a lot of details: the name of the script, the line where the error was found, a descriptive error message, and if it is a run-time error (ie. not a parsing error), it gives a stack trace showing the nested function calls.

--
Philippe Lhoste
--  (near) Paris -- France
--  Professional programmer and amateur artist
--  http://Phi.Lho.free.fr
--  --  --  --  --  --  --  --  --  --  --  --