hi i have a question and i need your help to tell me which script would be better at performance
if we have table with 1000 indexes with some data, and we needed only 25 indexes of data,which would be faster?
1.
function myFunction()
for i,v in pairs(table) do
if i <= 25 then
outputChatBox(tostring(v))
end
end
end
addEventHandler("onClientRender",root,myFunction)
2. (i think this one is better at performance)
function myFunction()
for i = 1,25 do
outputChatBox(tostring(table[i))
end
end
addEventHandler("onClientRender",root,myFunction)
i think that first method would be catastrophic because it would loop 1000 indexes 60 times a second,while second method would loop only 25 indexes 60 times a second,am i correct??