** returns the index for `key' if `key' is an appropriate key to live in ** the array part of the table, -1 otherwise. */
| 125 | ** the array part of the table, -1 otherwise. |
| 126 | */ |
| 127 | static int arrayindex (const TValue *key) { |
| 128 | if (ttisnumber(key)) { |
| 129 | lua_Number n = nvalue(key); |
| 130 | int k; |
| 131 | lua_number2int(k, n); |
| 132 | if (luai_numeq(cast_num(k), n)) |
| 133 | return k; |
| 134 | } |
| 135 | return -1; /* `key' did not match some condition */ |
| 136 | } |
| 137 | |
| 138 | |
| 139 | /* |