1

假设我正在从 C 中调用一个返回一个结果的 Lua 函数。如果它返回一个错误,结果还会在堆栈上吗?

例如,lua_pop以下代码中的第一个是否存在?

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;
}
4

0 回答 0