lua-users home
lua-l archive

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


You can register you own error report function
ej for windows

int lalert(lua_State *L)
{
	MessageBox(NULL,lua_tostring(L,-1),"Script Error",MB_OK);
	return 0;
}	

and under your lua initialization insert


lua_register(L,"_ALERT",lalert);


Robert Osfield wrote:
> Hi,
> 
> I rather new to Lua, and have slowly progressed to the point of
> successfully integrating C++ and Lua via Swig, and have a 3D app running
> with an init and frame being all controlled from Lua scripts.  Still
> rather simple scripts and simple C++ classes but progress no less. 
> 
> The bit I'm currently perplexed by is how to report back errors that
> occur in the Lua scripts - when errors, in my C++ code I have:
> 
>    int result = luaL_dofile(L, "frame.lua");
> 
> And when the script runs fine I get a 0, and when there is an error I
> get 1, which is all go so far, but... where do I go next to report the
> details of the error, such as the line number, and the error message?  I
> have searched the lua websites and headers and can't find anything to
> point me in the right direction.
> 
> Thanks in advance for you help,
> Robert.