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