** search function for integers */
| 444 | ** search function for integers |
| 445 | */ |
| 446 | const TValue *luaH_getint (Table *t, int key) { |
| 447 | /* (1 <= key && key <= t->sizearray) */ |
| 448 | if (cast(unsigned int, key-1) < cast(unsigned int, t->sizearray)) |
| 449 | return &t->array[key-1]; |
| 450 | else { |
| 451 | lua_Number nk = cast_num(key); |
| 452 | Node *n = hashnum(t, nk); |
| 453 | do { /* check whether `key' is somewhere in the chain */ |
| 454 | if (ttisnumber(gkey(n)) && luai_numeq(nvalue(gkey(n)), nk)) |
| 455 | return gval(n); /* that's it */ |
| 456 | else n = gnext(n); |
| 457 | } while (n); |
| 458 | return luaO_nilobject; |
| 459 | } |
| 460 | } |
| 461 | |
| 462 | |
| 463 | /* |
no test coverage detected