| 349 | |
| 350 | |
| 351 | LUA_API int lua_compare (lua_State *L, int index1, int index2, int op) { |
| 352 | const TValue *o1; |
| 353 | const TValue *o2; |
| 354 | int i = 0; |
| 355 | lua_lock(L); /* may call tag method */ |
| 356 | o1 = index2value(L, index1); |
| 357 | o2 = index2value(L, index2); |
| 358 | if (isvalid(L, o1) && isvalid(L, o2)) { |
| 359 | switch (op) { |
| 360 | case LUA_OPEQ: i = luaV_equalobj(L, o1, o2); break; |
| 361 | case LUA_OPLT: i = luaV_lessthan(L, o1, o2); break; |
| 362 | case LUA_OPLE: i = luaV_lessequal(L, o1, o2); break; |
| 363 | default: api_check(L, 0, "invalid option"); |
| 364 | } |
| 365 | } |
| 366 | lua_unlock(L); |
| 367 | return i; |
| 368 | } |
| 369 | |
| 370 | |
| 371 | LUA_API size_t lua_stringtonumber (lua_State *L, const char *s) { |
no test coverage detected