| 314 | |
| 315 | |
| 316 | LUA_API int lua_compare (lua_State *L, int index1, int index2, int op) { |
| 317 | StkId o1, o2; |
| 318 | int i = 0; |
| 319 | lua_lock(L); /* may call tag method */ |
| 320 | o1 = index2addr(L, index1); |
| 321 | o2 = index2addr(L, index2); |
| 322 | if (isvalid(o1) && isvalid(o2)) { |
| 323 | switch (op) { |
| 324 | case LUA_OPEQ: i = equalobj(L, o1, o2); break; |
| 325 | case LUA_OPLT: i = luaV_lessthan(L, o1, o2); break; |
| 326 | case LUA_OPLE: i = luaV_lessequal(L, o1, o2); break; |
| 327 | default: api_check(L, 0, "invalid option"); |
| 328 | } |
| 329 | } |
| 330 | lua_unlock(L); |
| 331 | return i; |
| 332 | } |
| 333 | |
| 334 | |
| 335 | LUA_API lua_Number lua_tonumberx (lua_State *L, int idx, int *isnum) { |
no test coverage detected