Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to list things?

Asked by
algo160 10
9 years ago

I'm forgetting this again, How do I iterate over tables (without keys) again?

1 answer

Log in to vote
0
Answered by 9 years ago

Is this what you are referring to?

local test = {1,2,3,4} -- Table with random numbers

for i, v in pairs(test) do -- using a loop to iterate over each value in the table
print(i) -- printing each value out in the output
end
Ad

Answer this question