mirror of https://github.com/rusefi/lua.git
detail
This commit is contained in:
parent
7d309480dd
commit
1dd8c9b6b6
27
ltable.c
27
ltable.c
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
** $Id: ltable.c,v 2.3 2004/04/30 20:13:38 roberto Exp roberto $
|
** $Id: ltable.c,v 2.4 2004/08/10 19:17:23 roberto Exp roberto $
|
||||||
** Lua tables (hash)
|
** Lua tables (hash)
|
||||||
** See Copyright Notice in lua.h
|
** See Copyright Notice in lua.h
|
||||||
*/
|
*/
|
||||||
|
@ -393,21 +393,6 @@ static TValue *newkey (lua_State *L, Table *t, const TValue *key) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
** generic search function
|
|
||||||
*/
|
|
||||||
static const TValue *luaH_getany (Table *t, const TValue *key) {
|
|
||||||
if (!ttisnil(key)) {
|
|
||||||
Node *n = luaH_mainposition(t, key);
|
|
||||||
do { /* check whether `key' is somewhere in the chain */
|
|
||||||
if (luaO_rawequalObj(gkey(n), key)) return gval(n); /* that's it */
|
|
||||||
else n = n->next;
|
|
||||||
} while (n);
|
|
||||||
}
|
|
||||||
return &luaO_nilobject;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** search function for integers
|
** search function for integers
|
||||||
*/
|
*/
|
||||||
|
@ -446,6 +431,7 @@ const TValue *luaH_getstr (Table *t, TString *key) {
|
||||||
*/
|
*/
|
||||||
const TValue *luaH_get (Table *t, const TValue *key) {
|
const TValue *luaH_get (Table *t, const TValue *key) {
|
||||||
switch (ttype(key)) {
|
switch (ttype(key)) {
|
||||||
|
case LUA_TNIL: return &luaO_nilobject;
|
||||||
case LUA_TSTRING: return luaH_getstr(t, rawtsvalue(key));
|
case LUA_TSTRING: return luaH_getstr(t, rawtsvalue(key));
|
||||||
case LUA_TNUMBER: {
|
case LUA_TNUMBER: {
|
||||||
int k;
|
int k;
|
||||||
|
@ -454,7 +440,14 @@ const TValue *luaH_get (Table *t, const TValue *key) {
|
||||||
return luaH_getnum(t, k); /* use specialized version */
|
return luaH_getnum(t, k); /* use specialized version */
|
||||||
/* else go through */
|
/* else go through */
|
||||||
}
|
}
|
||||||
default: return luaH_getany(t, key);
|
default: {
|
||||||
|
Node *n = luaH_mainposition(t, key);
|
||||||
|
do { /* check whether `key' is somewhere in the chain */
|
||||||
|
if (luaO_rawequalObj(gkey(n), key)) return gval(n); /* that's it */
|
||||||
|
else n = n->next;
|
||||||
|
} while (n);
|
||||||
|
return &luaO_nilobject;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue