Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Explanation of pairs and ipairs please?

What do pairs and ipairs mean?The comment on the question is something i have to do when i make a question how do i SEARCH?

1 comment

1

Please use the search feature before asking a question. This specific question has been asked quite a lot, so there are a lot of answers you can check.

1 answer

✓ Accepted answer

pairs will go through everything in a mixed table, ipairs won't.

Example:

local t={"SamuelKingx","Is","Epic",Yolo="You only live once"}

for i,v in pairs(t) do
print(i,v)
end

--[[
Output: 
1 SamuelKingx
2 Is
3 Epic
Yolo You only live once
]]

for i,v in ipairs(t) do
print(i,v)
end

--[[
Output: 
1 SamuelKingx
2 Is
3 Epic
]]

This discussion is preserved as it was. New answers, comments, and votes are closed.