| 322 | |
| 323 | |
| 324 | LUA_API int lua_compare (lua_State *L, int index1, int index2, int op) { |
| 325 | const TValue *o1; |
| 326 | const TValue *o2; |
| 327 | int i = 0; |
| 328 | lua_lock(L); /* may call tag method */ |
| 329 | o1 = index2value(L, index1); |
| 330 | o2 = index2value(L, index2); |
| 331 | if (isvalid(L, o1) && isvalid(L, o2)) { |
| 332 | switch (op) { |
| 333 | case LUA_OPEQ: i = luaV_equalobj(L, o1, o2); break; |
| 334 | case LUA_OPLT: i = luaV_lessthan(L, o1, o2); break; |
| 335 | case LUA_OPLE: i = luaV_lessequal(L, o1, o2); break; |
| 336 | default: api_check(L, 0, "invalid option"); |
| 337 | } |
| 338 | } |
| 339 | lua_unlock(L); |
| 340 | return i; |
| 341 | } |
| 342 | |
| 343 | |
| 344 | LUA_API size_t lua_stringtonumber (lua_State *L, const char *s) { |
no test coverage detected