Exactly what the title says... I ran into a snag where a for in pairs isn't fast enough to check through tens of thousands of records (only does 60 per second). I need to check to see if a part's specific position is already inside a table so that when I generate another part from the user's input, the part will be placed in an area that has never been occupied.
I couldn't find any more information on something called maps and would appreciate some clarity as it may seem as though it could solve my problem.
Here is some quick code just to help show what I mean:
local myTable = {}
local part = game.Workspace.Part
local testerPart = game.Workspace.testerPart
local testPosition = Vector3.new(10,10,10)
local counter = 0
---- The following while loop is just to show you guys, I know they are all the same values
while counter < 1,000 do
part:Clone()
table.insert(myTable, part.Position)
counter = counter + 1
end
---- This part is just too slow
for i, v in pairs(myTable) do
if v == testPosition then
break -- since it's already inside the table
elseif i = #myTable then ---if it reached the last record without finding a match
testerPart:Clone() ----then copy the testerPart
testerPart.Parent = game.Workspace --- parent it to Workspace
testerPart.Position = testPosition -- give it the position
end
end

2 comments
line 2 declares part as the part's position, and line 8 is cloning it. you cant clone a position dotdotdot
whoops, like I said that was very quick code that I typed up just to show what I mean