** Calls 'luaF_close' in protected mode. Return the original status ** or, in case of errors, the new status. */
| 926 | ** or, in case of errors, the new status. |
| 927 | */ |
| 928 | int luaD_closeprotected (lua_State *L, ptrdiff_t level, int status) { |
| 929 | CallInfo *old_ci = L->ci; |
| 930 | lu_byte old_allowhooks = L->allowhook; |
| 931 | for (;;) { /* keep closing upvalues until no more errors */ |
| 932 | struct CloseP pcl; |
| 933 | pcl.level = restorestack(L, level); pcl.status = status; |
| 934 | status = luaD_rawrunprotected(L, &closepaux, &pcl); |
| 935 | if (l_likely(status == LUA_OK)) /* no more errors? */ |
| 936 | return pcl.status; |
| 937 | else { /* an error occurred; restore saved state and repeat */ |
| 938 | L->ci = old_ci; |
| 939 | L->allowhook = old_allowhooks; |
| 940 | } |
| 941 | } |
| 942 | } |
| 943 | |
| 944 | |
| 945 | /* |
no test coverage detected