MCPcopy Create free account
hub / github.com/DFHack/dfhack / luaH_getint

Function luaH_getint

depends/lua/src/ltable.c:516–533  ·  view source on GitHub ↗

** search function for integers */

Source from the content-addressed store, hash-verified

514** search function for integers
515*/
516const TValue *luaH_getint (Table *t, lua_Integer key) {
517 /* (1 <= key && key <= t->sizearray) */
518 if (l_castS2U(key) - 1 < t->sizearray)
519 return &t->array[key - 1];
520 else {
521 Node *n = hashint(t, key);
522 for (;;) { /* check whether 'key' is somewhere in the chain */
523 if (ttisinteger(gkey(n)) && ivalue(gkey(n)) == key)
524 return gval(n); /* that's it */
525 else {
526 int nx = gnext(n);
527 if (nx == 0) break;
528 n += nx;
529 }
530 }
531 return luaO_nilobject;
532 }
533}
534
535
536/*

Callers 7

luaH_getFunction · 0.85
luaH_setintFunction · 0.85
unbound_searchFunction · 0.85
lua_getglobalFunction · 0.85
lua_rawgetiFunction · 0.85
lua_setglobalFunction · 0.85
lua_loadFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected