| 530 | |
| 531 | |
| 532 | LUA_API void lua_pushcclosure (lua_State *L, lua_CFunction fn, int n) { |
| 533 | lua_lock(L); |
| 534 | if (n == 0) { |
| 535 | setfvalue(L->top, fn); |
| 536 | api_incr_top(L); |
| 537 | } |
| 538 | else { |
| 539 | CClosure *cl; |
| 540 | api_checknelems(L, n); |
| 541 | api_check(L, n <= MAXUPVAL, "upvalue index too large"); |
| 542 | cl = luaF_newCclosure(L, n); |
| 543 | cl->f = fn; |
| 544 | L->top -= n; |
| 545 | while (n--) { |
| 546 | setobj2n(L, &cl->upvalue[n], L->top + n); |
| 547 | /* does not need barrier because closure is white */ |
| 548 | } |
| 549 | setclCvalue(L, L->top, cl); |
| 550 | api_incr_top(L); |
| 551 | luaC_checkGC(L); |
| 552 | } |
| 553 | lua_unlock(L); |
| 554 | } |
| 555 | |
| 556 | |
| 557 | LUA_API void lua_pushboolean (lua_State *L, int b) { |
no test coverage detected