Posted 09 October 2012 - 10:32 AM
So I was just browsing around the forums here when I noticed this code.
(I've cleaned and focused it down to what I'm asking.)
Can someone please explain exactly what "v in pairs(arg)" does?
And how it varies from, say.
Please note: I consider myself quite a good programmer, with several years experience in Java.
So I know my way around efficient coding and complex programs.
I also know I could just google this, but I figure, why not say hello to the CC community and meet a few people.
Cheers guys :D/>/>
(I've cleaned and focused it down to what I'm asking.)
local x = {1, 2, 3, 4, 5, 6}
for i, v in pairs(x) do
print(v)
end
Can someone please explain exactly what "v in pairs(arg)" does?
And how it varies from, say.
v = x.n
for i, v do
print(i)
end
Please note: I consider myself quite a good programmer, with several years experience in Java.
So I know my way around efficient coding and complex programs.
I also know I could just google this, but I figure, why not say hello to the CC community and meet a few people.
Cheers guys :D/>/>