[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: _ALERT gone in 5.0?
- From: <phil@...>
- Date: Wed, 25 Dec 2002 07:18:32 -0000
Björn De Meyer <bjorn.demeyer@pandora.be> said:
> phil@flamewars.org wrote:
> >
> > Sorry, that should have been like this:
> >
> > if (luaL_loadfile(L, filename) != 0)
> > {
> > // Error occurred
> > cout << "Error occurred: " << lua_tostring(L, -1);
> > }
> >
> > --
>
> I /think/ luaL_loadfile leaves a nil and an error string
> on the stack in case of error, so maybe it will work when
> you change the -1 to -2 ?
>
> --
> "No one knows true heroes, for they speak not of their greatness." --
> Daniel Remar.
> Björn De Meyer
> bjorn.demeyer@pandora.be
>
I've figured out the problem. A simple misunderstanding on my part. I didn't
realize that luaL_loadfile doesn't actually execute the chunk, and that you
need to do a lua_pcall to do this. I finally figured this out after taking a
look at the lua_dofile source in lauxlib. Thanks very much for everyones help.
Thanks, Philip Bock
--