| 256 | |
| 257 | |
| 258 | int luaV_lessthan (lua_State *L, const TValue *l, const TValue *r) { |
| 259 | int res; |
| 260 | if ((res = udatacompare(L, l, r, TM_LT)) != -1) |
| 261 | return res; |
| 262 | if (ttype(l) != ttype(r)) |
| 263 | return luaG_ordererror(L, l, r); |
| 264 | else if (ttisnumber(l)) |
| 265 | return luai_numlt(nvalue(l), nvalue(r)); |
| 266 | else if (ttisstring(l)) |
| 267 | return l_strcmp(rawtsvalue(l), rawtsvalue(r)) < 0; |
| 268 | else if ((res = call_orderTM(L, l, r, TM_LT)) != -1) |
| 269 | return res; |
| 270 | return luaG_ordererror(L, l, r); |
| 271 | } |
| 272 | |
| 273 | |
| 274 | static int lessequal (lua_State *L, const TValue *l, const TValue *r) { |
no test coverage detected