MCPcopy Create free account
hub / github.com/DFHack/dfhack / luaT_callTM

Function luaT_callTM

depends/lua/src/ltm.c:102–121  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

100
101
102void luaT_callTM (lua_State *L, const TValue *f, const TValue *p1,
103 const TValue *p2, TValue *p3, int hasres) {
104 ptrdiff_t result = savestack(L, p3);
105 StkId func = L->top;
106 setobj2s(L, func, f); /* push function (assume EXTRA_STACK) */
107 setobj2s(L, func + 1, p1); /* 1st argument */
108 setobj2s(L, func + 2, p2); /* 2nd argument */
109 L->top += 3;
110 if (!hasres) /* no result? 'p3' is third argument */
111 setobj2s(L, L->top++, p3); /* 3rd argument */
112 /* metamethod may yield only when called from Lua code */
113 if (isLua(L->ci))
114 luaD_call(L, func, hasres);
115 else
116 luaD_callnoyield(L, func, hasres);
117 if (hasres) { /* if has result, move it to its place */
118 p3 = restorestack(L, result);
119 setobjs2s(L, p3, --L->top);
120 }
121}
122
123
124int luaT_callbinTM (lua_State *L, const TValue *p1, const TValue *p2,

Callers 5

luaV_finishgetFunction · 0.85
luaV_finishsetFunction · 0.85
luaV_equalobjFunction · 0.85
luaV_objlenFunction · 0.85
luaT_callbinTMFunction · 0.85

Calls 2

luaD_callFunction · 0.85
luaD_callnoyieldFunction · 0.85

Tested by

no test coverage detected