[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Lua C Require problem
- From: "Shane Lee" <shaneplee@...>
- Date: Wed, 19 Dec 2007 10:16:24 -0600
On Dec 19, 2007 10:14 AM, Shane Lee <shaneplee@gmail.com> wrote:
> On Dec 18, 2007 3:49 PM, Luiz Henrique de Figueiredo
> <lhf@tecgraf.puc-rio.br> wrote:
> > > 32 luaL_dofile(state,"hello.lua");
> >
> > You should always test the return code and print the error message if any.
> >
>
> I modified his code and put in the proper error checks:
>
> int main (int argc, char *argv[]){
> lua_State *state = lua_open();
> openstdlibs( state );
> if (luaL_dofile(state,"hello.lua" !=0) {
> printf("Parsing Error for file 'hello.lua'");
> return (NULL);
> }
> return 0;
> }
>
> And running this gives what you might expect: Parsing Error for file 'hello.lua'
> I can't seem to make his code work at all...
>
> -Shane
>
Err, that was 'fprintf(stderr,' not 'printf', sorry about the mailercode :-(