I'm trying to print the items in my table but it errors, why?
Positions{"10","15","15"}
print(Positions)
I'm trying to print the items in my table but it errors, why?
Positions{"10","15","15"}
print(Positions)
for k, v in pairs(Table Name Here) do
print(tostring(k)..": "..tostring(v))
end
Try this - in this case put Positions instead of Table Name Here.
Let us take a simple approach to this. First we will add a for I statement to your script.
Positions{"10","15","15"}
for i = 1, num do
wait(0.1) --always add wait()
end
What for I statements do is they start at one, and count up to your desired number. In order to get your number of items, we will use #Positions (number of positions).
Positions{"10","15","15"}
for i = 1, #Positions do
wait(0.1)
end
Now we will add the command inside of the for I statement.
Positions{"10","15","15"}
for i = 1, #Positions do
wait(0.1)
print(Positions[i])
end
This basically prints the current number in you table the number is. Hope this helped.
print(Positions[1])
print(Positions[2])
print(Positions[3])
This discussion is preserved as it was. New answers, comments, and votes are closed.