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