Is matches[n] faster then accessing a local variable? For example:
for i=1,100 do
echo("Backstab "..matches[2])
end
OR
local s = matches[2]
for i=1,100 do
echo("Backstab "..s)
end
Thanks.
matches[n] faster then a local variable?
Re: matches[n] faster then a local variable?
the local is faster, generally speaking. But you're unlikely to see much of a real difference until you get to thousands of iterations of the loop.
Re: matches[n] faster then a local variable?
That being said there's good reason to use a local just for more readable code, too. Though not if you use variable names like 's' so much.