MCPcopy Create free account
hub / github.com/RomanKubiak/ctrlr / tryfuncTM

Function tryfuncTM

Source/Misc/lua/src/lua.c:5389–5401  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5387
5388
5389static StkId tryfuncTM (lua_State *L, StkId func) {
5390const TValue *tm = luaT_gettmbyobj(L, func, TM_CALL);
5391StkId p;
5392ptrdiff_t funcr = savestack(L, func);
5393if (!ttisfunction(tm))
5394luaG_typeerror(L, func, "call");
5395/* Open a hole inside the stack at `func' */
5396for (p = L->top; p > func; p--) setobjs2s(L, p, p-1);
5397incr_top(L);
5398func = restorestack(L, funcr); /* previous call may change stack */
5399setobj2s(L, func, tm); /* tag method is the new function to be called */
5400return func;
5401}
5402
5403
5404

Callers 1

luaD_precallFunction · 0.85

Calls 2

luaT_gettmbyobjFunction · 0.85
luaG_typeerrorFunction · 0.85

Tested by

no test coverage detected