MCPcopy Create free account
hub / github.com/CppCXY/EmmyLuaCodeStyle / lua_compare

Function lua_compare

3rd/lua-5.4.3/src/lapi.c:345–362  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 4

math_minFunction · 0.85
math_maxFunction · 0.85
tmoveFunction · 0.85
sort_compFunction · 0.85

Calls 4

index2valueFunction · 0.85
luaV_equalobjFunction · 0.85
luaV_lessthanFunction · 0.85
luaV_lessequalFunction · 0.85

Tested by

no test coverage detected