** Call a function (C or Lua). The function to be called is at *func. ** The arguments are on the stack, right after the function. ** When returns, all the results are on the stack, starting at the original ** function position. */
| 461 | ** function position. |
| 462 | */ |
| 463 | void luaD_call (lua_State *L, StkId func, int nResults, int allowyield) { |
| 464 | if (++L->nCcalls >= LUAI_MAXCCALLS) { |
| 465 | if (L->nCcalls == LUAI_MAXCCALLS) |
| 466 | luaG_runerror(L, "C stack overflow"); |
| 467 | else if (L->nCcalls >= (LUAI_MAXCCALLS + (LUAI_MAXCCALLS>>3))) |
| 468 | luaD_throw(L, LUA_ERRERR); /* error while handling stack error */ |
| 469 | } |
| 470 | intptr_t remaining = stack_remaining(); |
| 471 | if (L->runerror == 0 && remaining < LUAI_MINCSTACK) |
| 472 | luaG_runerror(L, "C stack overflow"); |
| 473 | if (L->runerror != 0 && remaining < LUAI_MINCSTACK / 2) |
| 474 | luaD_throw(L, LUA_ERRERR); /* error while handling stack error */ |
| 475 | if (!allowyield) L->nny++; |
| 476 | if (!luaD_precall(L, func, nResults)) /* is a Lua function? */ |
| 477 | luaV_execute(L); /* call it */ |
| 478 | if (!allowyield) L->nny--; |
| 479 | L->nCcalls--; |
| 480 | } |
| 481 | |
| 482 | |
| 483 | static void finishCcall (lua_State *L) { |
no test coverage detected