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