If lua_pcall returns error, are there still return values left on the stack?

670 Views Asked by At

Suppose I'm calling a Lua function from C which returns one result. If it returns an error, will the results still be on the stack?

For example, should the first lua_pop in the following code exist?

if (lua_pcall(L, nArgs, 1, 0)) {
   lua_pop(L, 1); //should this exist?
   DisplayLuaError(L);
   return -1;
} else {
   int x = lua_tonumber(L, -1);
   lua_pop(1);
   return x;
}
0

There are 0 best solutions below