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

Can anyone explain me how the functions Next and In Pairs Mean?

Can anyone explain me how the functions Next and In Pairs Mean? The wiki is just too complicated for me.

1 answer

✓ Accepted answer

pairs(table) returns next,table,nil.

in a for loop, you can use it to loop over each key,value in the given table.

Eg.

local Example = {
	"Hello";
	"World";
	"Bye!";
}

for _,Value in pairs(Example) do
	print(Value)
end

--[[
	this would print
	Hello
	World
	Bye!
]]

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