MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / luaT_callorderTM

Function luaT_callorderTM

lib/lua/src/ltm.c:201–218  ·  view source on GitHub ↗

** Calls an order tag method. ** For lessequal, LUA_COMPAT_LT_LE keeps compatibility with old ** behavior: if there is no '__le', try '__lt', based on l <= r iff ** !(r < l) (assuming a total order). If the metamethod yields during ** this substitution, the continuation has to know about it (to negate ** the result of r<l); bit CIST_LEQ in the call status keeps that ** information. */

Source from the content-addressed store, hash-verified

199** information.
200*/
201int luaT_callorderTM (lua_State *L, const TValue *p1, const TValue *p2,
202 TMS event) {
203 if (callbinTM(L, p1, p2, L->top.p, event)) /* try original event */
204 return !l_isfalse(s2v(L->top.p));
205#if defined(LUA_COMPAT_LT_LE)
206 else if (event == TM_LE) {
207 /* try '!(p2 < p1)' for '(p1 <= p2)' */
208 L->ci->callstatus |= CIST_LEQ; /* mark it is doing 'lt' for 'le' */
209 if (callbinTM(L, p2, p1, L->top.p, TM_LT)) {
210 L->ci->callstatus ^= CIST_LEQ; /* clear mark */
211 return l_isfalse(s2v(L->top.p));
212 }
213 /* else error will remove this 'ci'; no need to clear mark */
214 }
215#endif
216 luaG_ordererror(L, p1, p2); /* no metamethod found */
217 return 0; /* to avoid warnings */
218}
219
220
221int luaT_callorderiTM (lua_State *L, const TValue *p1, int v2,

Callers 3

lessthanothersFunction · 0.85
lessequalothersFunction · 0.85
luaT_callorderiTMFunction · 0.85

Calls 2

callbinTMFunction · 0.85
luaG_ordererrorFunction · 0.85

Tested by

no test coverage detected