MCPcopy Create free account
hub / github.com/RomanKubiak/ctrlr / luaH_getnum

Function luaH_getnum

Source/Misc/lua/src/lua.c:9675–9689  ·  view source on GitHub ↗

** search function for integers */

Source from the content-addressed store, hash-verified

9673** search function for integers
9674*/
9675const TValue *luaH_getnum (Table *t, int key) {
9676/* (1 <= key && key <= t->sizearray) */
9677if (cast(unsigned int, key-1) < cast(unsigned int, t->sizearray))
9678return &t->array[key-1];
9679else {
9680lua_Number nk = cast_num(key);
9681Node *n = hashnum(t, nk);
9682do { /* check whether `key' is somewhere in the chain */
9683if (ttisnumber(gkey(n)) && luai_numeq(nvalue(gkey(n)), nk))
9684return gval(n); /* that's it */
9685else n = gnext(n);
9686} while (n);
9687return luaO_nilobject;
9688}
9689}
9690
9691
9692/*

Callers 4

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

Calls 1

hashnumFunction · 0.85

Tested by

no test coverage detected