lua

A copy of the Lua development repository
Log | Files | Refs | README

commit 1e0ad018cef2a8e771787f126ce2150028749411
parent 95735bda46278a4bc0966d8a3c9079dd0072c51e
Author: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
Date:   Tue, 10 Dec 2019 13:49:53 -0300

Comment about LUA_COMPAT_LT_LE moved to proper place

Diffstat:
Mltm.c | 9+++++++++
Mlvm.c | 9+++------
2 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/ltm.c b/ltm.c @@ -188,6 +188,15 @@ void luaT_trybiniTM (lua_State *L, const TValue *p1, lua_Integer i2, } +/* +** 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. +*/ 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 */ diff --git a/lvm.c b/lvm.c @@ -541,11 +541,6 @@ int luaV_lessthan (lua_State *L, const TValue *l, const TValue *r) { /* ** return 'l <= r' for non-numbers. -** If it needs a metamethod and 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. */ static int lessequalothers (lua_State *L, const TValue *l, const TValue *r) { lua_assert(!ttisnumber(l) || !ttisnumber(r)); @@ -986,7 +981,9 @@ void luaV_finishOp (lua_State *L) { /* -** Order operations with register operands. +** Order operations with register operands. 'opf' actually works +** for all numbers, but the fast track improves performance for +** integers. */ #define op_order(L,opi,opf,other) { \ int cond; \