I have seen a lot of scripts use in pairs and in ipairs, but I can't seem to understand what they do. Could someone please explain their differences and some examples on how to use them?
✓ ANSWER ACCEPTED
What's the difference between `in pairs` and `in ipairs`, and how do I use them?
1 answer
✓ Accepted answer
Do your research! This question has an answer both on the wiki and on this site!
-- Wiki
"Two commonly-used standard library iterator functions are pairs and ipairs. These functions return table keys and their corresponding values. pairs iterates through the entire table, even if the key is non-numerical (such as "Hi"), treating it as a dictionary. ipairs iterates through the table as if it were an array, starting at 1 and counting up consecutive integer indices. Once it hits a nil value, it will stop looping through the table. Also, please note that pairs does not iterate through the table in any particular order."
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
Thanks!