Lines Matching refs:key
97 static Node *mainposition (const Table *t, const TValue *key) { in mainposition() argument
98 switch (ttype(key)) { in mainposition()
100 return hashnum(t, nvalue(key)); in mainposition()
102 TString *s = rawtsvalue(key); in mainposition()
107 return hashstr(t, rawtsvalue(key)); in mainposition()
110 return hashstr(t, rawtsvalue(key)); in mainposition()
112 return hashboolean(t, bvalue(key)); in mainposition()
114 return hashpointer(t, pvalue(key)); in mainposition()
116 return hashpointer(t, fvalue(key)); in mainposition()
118 return hashpointer(t, gcvalue(key)); in mainposition()
127 static int arrayindex (const TValue *key) { in arrayindex() argument
128 if (ttisnumber(key)) { in arrayindex()
129 lua_Number n = nvalue(key); in arrayindex()
144 static int findindex (lua_State *L, Table *t, StkId key) { in findindex() argument
146 if (ttisnil(key)) return -1; /* first iteration */ in findindex()
147 i = arrayindex(key); in findindex()
151 Node *n = mainposition(t, key); in findindex()
154 if (luaV_rawequalobj(gkey(n), key) || in findindex()
155 (ttisdeadkey(gkey(n)) && iscollectable(key) && in findindex()
156 deadvalue(gkey(n)) == gcvalue(key))) { in findindex()
169 int luaH_next (lua_State *L, Table *t, StkId key) { in luaH_next() argument
170 int i = findindex(L, t, key); /* find original element */ in luaH_next()
173 setnvalue(key, cast_num(i+1)); in luaH_next()
174 setobj2s(L, key+1, &t->array[i]); in luaH_next()
180 setobj2s(L, key, gkey(gnode(t, i))); in luaH_next()
181 setobj2s(L, key+1, gval(gnode(t, i))); in luaH_next()
218 static int countint (const TValue *key, int *nums) { in countint() argument
219 int k = arrayindex(key); in countint()
405 TValue *luaH_newkey (lua_State *L, Table *t, const TValue *key) { in luaH_newkey() argument
407 if (ttisnil(key)) luaG_runerror(L, "table index is nil"); in luaH_newkey()
409 else if (ttisnumber(key) && luai_numisnan(L, nvalue(key))) in luaH_newkey()
412 mp = mainposition(t, key); in luaH_newkey()
417 rehash(L, t, key); /* grow table */ in luaH_newkey()
419 return luaH_set(L, t, key); /* insert key into grown table */ in luaH_newkey()
438 setobj2t(L, gkey(mp), key); in luaH_newkey()
439 luaC_barrierback(L, obj2gco(t), key); in luaH_newkey()
448 const TValue *luaH_getint (Table *t, int key) { in luaH_getint() argument
450 if (cast(unsigned int, key-1) < cast(unsigned int, t->sizearray)) in luaH_getint()
451 return &t->array[key-1]; in luaH_getint()
453 lua_Number nk = cast_num(key); in luaH_getint()
468 const TValue *luaH_getstr (Table *t, TString *key) { in luaH_getstr() argument
469 Node *n = hashstr(t, key); in luaH_getstr()
470 lua_assert(key->tsv.tt == LUA_TSHRSTR); in luaH_getstr()
472 if (ttisshrstring(gkey(n)) && eqshrstr(rawtsvalue(gkey(n)), key)) in luaH_getstr()
483 const TValue *luaH_get (Table *t, const TValue *key) { in luaH_get() argument
484 switch (ttype(key)) { in luaH_get()
485 case LUA_TSHRSTR: return luaH_getstr(t, rawtsvalue(key)); in luaH_get()
489 lua_Number n = nvalue(key); in luaH_get()
497 Node *n = mainposition(t, key); in luaH_get()
499 if (luaV_rawequalobj(gkey(n), key)) in luaH_get()
513 TValue *luaH_set (lua_State *L, Table *t, const TValue *key) { in luaH_set() argument
514 const TValue *p = luaH_get(t, key); in luaH_set()
517 else return luaH_newkey(L, t, key); in luaH_set()
521 void luaH_setint (lua_State *L, Table *t, int key, TValue *value) { in luaH_setint() argument
522 const TValue *p = luaH_getint(t, key); in luaH_setint()
528 setnvalue(&k, cast_num(key)); in luaH_setint()
585 Node *luaH_mainposition (const Table *t, const TValue *key) { in luaH_mainposition() argument
586 return mainposition(t, key); in luaH_mainposition()