MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / luaH_getnum

Function luaH_getnum

deps/lua/src/ltable.c:435–449  ·  view source on GitHub ↗

** search function for integers */

Source from the content-addressed store, hash-verified

433** search function for integers
434*/
435const TValue *luaH_getnum (Table *t, int key) {
436 /* (1 <= key && key <= t->sizearray) */
437 if (cast(unsigned int, key-1) < cast(unsigned int, t->sizearray))
438 return &t->array[key-1];
439 else {
440 lua_Number nk = cast_num(key);
441 Node *n = hashnum(t, nk);
442 do { /* check whether `key' is somewhere in the chain */
443 if (ttisnumber(gkey(n)) && luai_numeq(nvalue(gkey(n)), nk))
444 return gval(n); /* that's it */
445 else n = gnext(n);
446 } while (n);
447 return luaO_nilobject;
448 }
449}
450
451
452/*

Callers 4

luaH_getFunction · 0.85
luaH_setnumFunction · 0.85
unbound_searchFunction · 0.85
lua_rawgetiFunction · 0.85

Calls 1

hashnumFunction · 0.85

Tested by

no test coverage detected