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

What method of finding ojects in a table is faster?

What method of sorting through, and getting all the objects in a table, is faster?

for _, x in next, table do
    print(x)
end

--or

for i = 1, #table do
    local x = table[i]
    print(x)
end

These are going to be sorting through a lot of objects at a time (up to 1000) so I'd like to know which one is better for performance, OR if there's one faster that I'm not using :)

1 answer

✓ Accepted answer

they both finish in a matter of miliseconds, however method 1 is specifically meant for going through tables and arrays, and method two is used for doing stuff to a group of data.

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