yes ive looked it up and i know what the “difference” is
everyone always says “ipairs for array, pairs for dictionaries”
yes
but why?
what happens if i use ipairs for dictionaries or pairs for arrays? what is the actual difference between them?
yes ive looked it up and i know what the “difference” is
everyone always says “ipairs for array, pairs for dictionaries”
yes
but why?
what happens if i use ipairs for dictionaries or pairs for arrays? what is the actual difference between them?
The I in ipairs is for index. Arrays have an index, dictionaries do not.
yes
i know
but what is the point
what does ipairs do that pairs does not
Ipairs return index-value pairs and pairs return key-value pairs.
pairs
iterates key-value pairs of a table. An advantage is that it consider all the keys (ipairs
consider indexes only), a disadvantage is that it doesn’t iterate in order (ipairs
can do that)