[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: luaL_dofile(): how do I get errors?
- From: Sam Roberts <sroberts@...>
- Date: Wed, 31 Jan 2007 14:29:04 -0800
On Wed, Jan 31, 2007 at 03:52:49PM -0500, Jerome Vuarand wrote:
> Shea Martin wrote:
> > If my embedded interpreter encounters an error in the script,
> > during the
> > dofile() routine, it just punts. dofile return a value of 1,
> > so I know an error was encountered, but I have no idea what
> > the error was. There is no error message printed, etc.
> >
> > Is there any sort of way to determine what is wrong with my
> > script, and print a message to the user?
> >
> > I don't think lua_pcall() is what I want, as it calls a
> > function. I am still loading the script.
>
> As you can see in its doc luaL_dofile is defined as:
>
> luaL_loadfile(L, filename) || lua_pcall(L, 0, LUA_MULTRET, 0))
The last arg to lua_pcall() is useful. Look at lua.c, the interpreter
code, to see how to use it.
Sam