MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / tryfuncTM

Function tryfuncTM

deps/lua/src/ldo.c:244–256  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

242
243
244static StkId tryfuncTM (lua_State *L, StkId func) {
245 const TValue *tm = luaT_gettmbyobj(L, func, TM_CALL);
246 StkId p;
247 ptrdiff_t funcr = savestack(L, func);
248 if (!ttisfunction(tm))
249 luaG_typeerror(L, func, "call");
250 /* Open a hole inside the stack at `func' */
251 for (p = L->top; p > func; p--) setobjs2s(L, p, p-1);
252 incr_top(L);
253 func = restorestack(L, funcr); /* previous call may change stack */
254 setobj2s(L, func, tm); /* tag method is the new function to be called */
255 return func;
256}
257
258
259

Callers 1

luaD_precallFunction · 0.85

Calls 2

luaT_gettmbyobjFunction · 0.85
luaG_typeerrorFunction · 0.85

Tested by

no test coverage detected