diff options
Diffstat (limited to 'ltm.c')
| -rw-r--r-- | ltm.c | 16 |
1 files changed, 0 insertions, 16 deletions
| @@ -196,28 +196,12 @@ void luaT_trybiniTM (lua_State *L, const TValue *p1, lua_Integer i2, | |||
| 196 | 196 | ||
| 197 | /* | 197 | /* |
| 198 | ** Calls an order tag method. | 198 | ** Calls an order tag method. |
| 199 | ** For lessequal, LUA_COMPAT_LT_LE keeps compatibility with old | ||
| 200 | ** behavior: if there is no '__le', try '__lt', based on l <= r iff | ||
| 201 | ** !(r < l) (assuming a total order). If the metamethod yields during | ||
| 202 | ** this substitution, the continuation has to know about it (to negate | ||
| 203 | ** the result of r<l); bit CIST_LEQ in the call status keeps that | ||
| 204 | ** information. | ||
| 205 | */ | 199 | */ |
| 206 | int luaT_callorderTM (lua_State *L, const TValue *p1, const TValue *p2, | 200 | int luaT_callorderTM (lua_State *L, const TValue *p1, const TValue *p2, |
| 207 | TMS event) { | 201 | TMS event) { |
| 208 | int tag = callbinTM(L, p1, p2, L->top.p, event); /* try original event */ | 202 | int tag = callbinTM(L, p1, p2, L->top.p, event); /* try original event */ |
| 209 | if (tag >= 0) /* found tag method? */ | 203 | if (tag >= 0) /* found tag method? */ |
| 210 | return !tagisfalse(tag); | 204 | return !tagisfalse(tag); |
| 211 | #if defined(LUA_COMPAT_LT_LE) | ||
| 212 | else if (event == TM_LE) { | ||
| 213 | /* try '!(p2 < p1)' for '(p1 <= p2)' */ | ||
| 214 | L->ci->callstatus |= CIST_LEQ; /* mark it is doing 'lt' for 'le' */ | ||
| 215 | tag = callbinTM(L, p2, p1, L->top.p, TM_LT); | ||
| 216 | L->ci->callstatus ^= CIST_LEQ; /* clear mark */ | ||
| 217 | if (tag >= 0) /* found tag method? */ | ||
| 218 | return tagisfalse(tag); | ||
| 219 | } | ||
| 220 | #endif | ||
| 221 | luaG_ordererror(L, p1, p2); /* no metamethod found */ | 205 | luaG_ordererror(L, p1, p2); /* no metamethod found */ |
| 222 | return 0; /* to avoid warnings */ | 206 | return 0; /* to avoid warnings */ |
| 223 | } | 207 | } |
