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