** Call closing method for object 'obj' with error object 'err'. The ** boolean 'yy' controls whether the call is yieldable. ** (This function assumes EXTRA_STACK.) */
| 105 | ** (This function assumes EXTRA_STACK.) |
| 106 | */ |
| 107 | static void callclosemethod (lua_State *L, TValue *obj, TValue *err, int yy) { |
| 108 | StkId top = L->top.p; |
| 109 | StkId func = top; |
| 110 | const TValue *tm = luaT_gettmbyobj(L, obj, TM_CLOSE); |
| 111 | setobj2s(L, top++, tm); /* will call metamethod... */ |
| 112 | setobj2s(L, top++, obj); /* with 'self' as the 1st argument */ |
| 113 | if (err != NULL) /* if there was an error... */ |
| 114 | setobj2s(L, top++, err); /* then error object will be 2nd argument */ |
| 115 | L->top.p = top; /* add function and arguments */ |
| 116 | if (yy) |
| 117 | luaD_call(L, func, 0); |
| 118 | else |
| 119 | luaD_callnoyield(L, func, 0); |
| 120 | } |
| 121 | |
| 122 | |
| 123 | /* |
no test coverage detected