MCPcopy Create free account
hub / github.com/BZFlag-Dev/bzflag / luaH_getnum

Function luaH_getnum

other_src/lua/src/ltable.cpp:438–452  ·  view source on GitHub ↗

** search function for integers */

Source from the content-addressed store, hash-verified

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

Callers 5

luaV_executeFunction · 0.70
luaH_getFunction · 0.70
luaH_setnumFunction · 0.70
unbound_searchFunction · 0.70
lua_rawgetiFunction · 0.70

Calls 1

hashnumFunction · 0.70

Tested by

no test coverage detected