** search function for integers */
| 9673 | ** search function for integers |
| 9674 | */ |
| 9675 | const TValue *luaH_getnum (Table *t, int key) { |
| 9676 | /* (1 <= key && key <= t->sizearray) */ |
| 9677 | if (cast(unsigned int, key-1) < cast(unsigned int, t->sizearray)) |
| 9678 | return &t->array[key-1]; |
| 9679 | else { |
| 9680 | lua_Number nk = cast_num(key); |
| 9681 | Node *n = hashnum(t, nk); |
| 9682 | do { /* check whether `key' is somewhere in the chain */ |
| 9683 | if (ttisnumber(gkey(n)) && luai_numeq(nvalue(gkey(n)), nk)) |
| 9684 | return gval(n); /* that's it */ |
| 9685 | else n = gnext(n); |
| 9686 | } while (n); |
| 9687 | return luaO_nilobject; |
| 9688 | } |
| 9689 | } |
| 9690 | |
| 9691 | |
| 9692 | /* |
no test coverage detected