David Green wrote:
That's true. But it's got me thinking about the connection between arrays and "associative" arrays. In fact, the user doesn't need to know that a "hash" is implemented with a hash table, and an "array" isn't; and nothing stops you from using numbers as hash keys.
I believe Lua treats arrays just like hashes indexed by integers. I don't know if they optimize anything under the hood.