lua-users home
lua-l archive

Re: Lua C Require problem

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


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

AltStyle によって変換されたページ (->オリジナル) /