MCPcopy Create free account
hub / github.com/EmmyLua/EmmyLuaDebugger / luaH_get

Function luaH_get

third-party/lua-5.5.0/src/ltable.c:1020–1042  ·  view source on GitHub ↗

** main search function */

Source from the content-addressed store, hash-verified

1018** main search function
1019*/
1020lu_byte luaH_get (Table *t, const TValue *key, TValue *res) {
1021 const TValue *slot;
1022 switch (ttypetag(key)) {
1023 case LUA_VSHRSTR:
1024 slot = luaH_Hgetshortstr(t, tsvalue(key));
1025 break;
1026 case LUA_VNUMINT:
1027 return luaH_getint(t, ivalue(key), res);
1028 case LUA_VNIL:
1029 slot = &absentkey;
1030 break;
1031 case LUA_VNUMFLT: {
1032 lua_Integer k;
1033 if (luaV_flttointeger(fltvalue(key), &k, F2Ieq)) /* integral index? */
1034 return luaH_getint(t, k, res); /* use specialized version */
1035 /* else... */
1036 } /* FALLTHROUGH */
1037 default:
1038 slot = getgeneric(t, key, 0);
1039 break;
1040 }
1041 return finishnodeget(slot, res);
1042}
1043
1044
1045/*

Callers 3

lua_rawgetFunction · 0.70
lua_rawgetpFunction · 0.70
k2protoFunction · 0.70

Calls 5

luaH_HgetshortstrFunction · 0.85
finishnodegetFunction · 0.85
luaH_getintFunction · 0.70
luaV_flttointegerFunction · 0.70
getgenericFunction · 0.70

Tested by

no test coverage detected