** returns the index for `key' if `key' is an appropriate key to live in ** the array part of the table, -1 otherwise. */
| 152 | ** the array part of the table, -1 otherwise. |
| 153 | */ |
| 154 | static int arrayindex (const TValue *key) { |
| 155 | if (ttisnumber(key)) { |
| 156 | lua_Number n = nvalue(key); |
| 157 | int k; |
| 158 | lua_number2int(k, n); |
| 159 | if (luai_numeq(cast_num(k), n)) |
| 160 | return k; |
| 161 | } |
| 162 | return -1; /* `key' did not match some condition */ |
| 163 | } |
| 164 | |
| 165 | |
| 166 | /* |