Okay, so I started working with dictionaries because, well, they're more powerful than simple lists, and easier to use as well.
From a script someone else made in Lua, I've been able to deduct that when iterating over a Lua array, it does so in the order that was given.
However, when trying to replicate that using Python dictionaries, I fail. Python iterates over its dictionaries in an arbitrary way, but unfortunately not in the order the keys were provided.
My questions:
- Am I right about the Lua arrays behaviour? If not, disregard the following questions.
- Is it possible to have custom iteration over Python dictionaries? And if yes:
- How exactly?
From a script someone else made in Lua, I've been able to deduct that when iterating over a Lua array, it does so in the order that was given.
However, when trying to replicate that using Python dictionaries, I fail. Python iterates over its dictionaries in an arbitrary way, but unfortunately not in the order the keys were provided.
My questions:
- Am I right about the Lua arrays behaviour? If not, disregard the following questions.
- Is it possible to have custom iteration over Python dictionaries? And if yes:
- How exactly?