lua-users home
lua-l archive

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


mark greenlancer wrote:

hello,

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,...))?


this is my c++ loader for lua script (from an MFC project):

   int status = luaL_loadfile(L,lpszPathName);
	
   if (status == 0)   // parsed OK
      status = lua_pcall(L, 0, LUA_MULTRET, 0);  /* call main */

   if (status != 0) {
      last_error = lua_tostring(L, -1);
      lua_pop(L, 1);  // remove error message
   }
   loaded = status == 0;
	return loaded;