Fix compiler warnings in examples when using -std=c++98 -std=gnu89 -pedantic -Wreturn-type

This commit is contained in:
William S Fulton 2014-05-24 00:14:01 +01:00
commit f39ed94419
43 changed files with 75 additions and 73 deletions

View file

@ -53,7 +53,7 @@ int call_add(lua_State *L,int a,int b,int* res) {
lua_getglobal(L, "add"); /* function to be called */
if (!lua_isfunction(L,-1)) {
printf("[C] error: cannot find function 'add'\n");
lua_settop(L,top); // reset
lua_settop(L,top);
return 0;
}
lua_pushnumber(L,a);
@ -61,18 +61,18 @@ int call_add(lua_State *L,int a,int b,int* res) {
if (lua_pcall(L, 2, 1, 0) != 0) /* call function with 2 arguments and 1 result */
{
printf("[C] error running function `add': %s\n",lua_tostring(L, -1));
lua_settop(L,top); // reset
lua_settop(L,top);
return 0;
}
// check results
/* check results */
if (!lua_isnumber(L,-1)) {
printf("[C] error: returned value is not a number\n");
lua_settop(L,top); // reset
lua_settop(L,top);
return 0;
}
*res=(int)lua_tonumber(L,-1);
lua_settop(L,top); /* reset stack */
return 1; // ok
return 1;
}
/* This is a variargs call function for calling from C into Lua.