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