| 272 | |
| 273 | |
| 274 | static StkId tryfuncTM (lua_State *L, StkId func) { |
| 275 | const TValue *tm = luaT_gettmbyobj(L, func, TM_CALL); |
| 276 | StkId p; |
| 277 | ptrdiff_t funcr = savestack(L, func); |
| 278 | if (!ttisfunction(tm)) |
| 279 | luaG_typeerror(L, func, "call"); |
| 280 | /* Open a hole inside the stack at `func' */ |
| 281 | for (p = L->top; p > func; p--) setobjs2s(L, p, p-1); |
| 282 | incr_top(L); |
| 283 | func = restorestack(L, funcr); /* previous call may change stack */ |
| 284 | setobj2s(L, func, tm); /* tag method is the new function to be called */ |
| 285 | return func; |
| 286 | } |
| 287 | |
| 288 | |
| 289 |
no test coverage detected