This is most likely a simple issue, but I’m just trying to learn.
I have 4 values in my table. How do I print the 1st, 2nd, 3rd, and 4th value of that table with an in pairs loop?
for a,b in pairs(SavedAnswers) do
print("SavedQuestion1Text: "..b[1])
print("SavedQuestion2Text: "..b[2])
print("SavedQuestion3Text: "..b[3])
print("SavedQuestion4Text: "..b[4])
end
Output Error
attempt to concatenate field '?' (a nil value)
I just realized that would print all of those 4 times. Just ignore that for now.
Off what I can see you made a mistake. B in your loop is the actual values in your table. So what you are trying to do is that you are printing value 1 of value and that is wrong. You don’t have to access each valu individualy cuz the table do that to you automatically. Remover these things in you script [1] [2] etc and just print once