From 8c8a91f2ef7acccb99e3737913faad8d48b39571 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Fri, 24 Aug 2018 10:17:54 -0300 Subject: Deprecated the emulation of '__le' using '__lt' As hinted in the manual for Lua 5.3, the emulation of the metamethod for '__le' using '__le' has been deprecated. It is slow, complicates the logic, and it is easy to avoid this emulation by defining a proper '__le' function. Moreover, often this emulation was used wrongly, with a programmer assuming that an order is total when it is not (e.g., NaN in floating-point numbers). --- ltm.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'ltm.c') diff --git a/ltm.c b/ltm.c index 1c1a18b7..5c148180 100644 --- a/ltm.c +++ b/ltm.c @@ -188,6 +188,7 @@ int luaT_callorderTM (lua_State *L, const TValue *p1, const TValue *p2, TMS event) { if (callbinTM(L, p1, p2, L->top, event)) /* try original event */ return !l_isfalse(s2v(L->top)); +#if defined(LUA_COMPAT_LT_LE) else if (event == TM_LE) { /* try '!(p2 < p1)' for '(p1 <= p2)' */ L->ci->callstatus |= CIST_LEQ; /* mark it is doing 'lt' for 'le' */ @@ -197,6 +198,7 @@ int luaT_callorderTM (lua_State *L, const TValue *p1, const TValue *p2, } /* else error will remove this 'ci'; no need to clear mark */ } +#endif luaG_ordererror(L, p1, p2); /* no metamethod found */ return 0; /* to avoid warnings */ } -- cgit v1.2.3-55-g6feb