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

Function luaH_get

other_src/lua/src/ltable.cpp:472–494  ·  view source on GitHub ↗

** main search function */

Source from the content-addressed store, hash-verified

470** main search function
471*/
472const TValue *luaH_get (Table *t, const TValue *key) {
473 switch (ttype(key)) {
474 case LUA_TNIL: return luaO_nilobject;
475 case LUA_TSTRING: return luaH_getstr(t, rawtsvalue(key));
476 case LUA_TNUMBER: {
477 int k;
478 lua_Number n = nvalue(key);
479 lua_number2int(k, n);
480 if (luai_numeq(cast_num(k), nvalue(key))) /* index is int? */
481 return luaH_getnum(t, k); /* use specialized version */
482 /* else go through */
483 }
484 default: {
485 Node *n = mainposition(t, key);
486 do { /* check whether `key' is somewhere in the chain */
487 if (luaO_rawequalObj(key2tval(n), key))
488 return gval(n); /* that's it */
489 else n = gnext(n);
490 } while (n);
491 return luaO_nilobject;
492 }
493 }
494}
495
496
497#ifdef LUA_READONLY_TABLES /*BZ*/

Callers 4

luaG_errormsgFunction · 0.70
luaV_gettableFunction · 0.70
luaH_setFunction · 0.70
lua_rawgetFunction · 0.70

Calls 4

luaH_getstrFunction · 0.70
luaH_getnumFunction · 0.70
mainpositionFunction · 0.70
luaO_rawequalObjFunction · 0.70

Tested by

no test coverage detected