I’m not actually having any issues, I’m just looking to learn and understand code on a deeper level.
If this is the wrong category to post this in, I apologise. I wasn’t sure where else to post this.
So lua allows you to write for-loops in many different ways. Some of the most common forms are:
for i = first, last, interval do
end
for key, value in pairs ({}) do
end
for key, value in ipairs({}) do
end
for key, value in {} do
end
The last form in {} was most recently added to luau. But how is it different from in pairs() and how do you determine which form of for-loop you should use? So far, I’ve always used in pairs() and never needed to use in ipairs(). Am I doing something wrong here? This topic explains how ipairs differs from in pairs, though I’ve never had a use case where the functionality of ipairs outweighs that of in pairs.
I’m eager to learn and find out more about this.