| 239 | |
| 240 | |
| 241 | static int lessequal (lua_State *L, const TValue *l, const TValue *r) { |
| 242 | int res; |
| 243 | if (ttype(l) != ttype(r)) |
| 244 | return luaG_ordererror(L, l, r); |
| 245 | else if (ttisnumber(l)) |
| 246 | return luai_numle(nvalue(l), nvalue(r)); |
| 247 | else if (ttisstring(l)) |
| 248 | return l_strcmp(rawtsvalue(l), rawtsvalue(r)) <= 0; |
| 249 | else if ((res = call_orderTM(L, l, r, TM_LE)) != -1) /* first try `le' */ |
| 250 | return res; |
| 251 | else if ((res = call_orderTM(L, r, l, TM_LT)) != -1) /* else try `lt' */ |
| 252 | return !res; |
| 253 | return luaG_ordererror(L, l, r); |
| 254 | } |
| 255 | |
| 256 | |
| 257 | int luaV_equalval (lua_State *L, const TValue *t1, const TValue *t2) { |
no test coverage detected