reading strings from table doesn't work

Hi there,

so I have some text that I packed into a table in a separate lua file named textFile.lua

it looks like this:

local text = {

        {“text1 blablabla”},

        {“text2 blablabla”},

        {“text3 blablabla”},

        {“text4 blablabla”}

}

return text

–So now I will print the text out from a different lua file.

–On the top of the lua file is also:

local text = require(“textFile”)

–Then I want to print the first string.

print( text[1][1] )

– And it works!
 

– BUT then I want to print the second string by writing:  print( text[1][2] )   and it shows me NIL!

Can someone explain me why ?
I already spent a lot of time with this issue and can’t solve it.

Thanks in advance!!!

The way you’ve set it up, the second string is text[2][1], not text[1][2]

You have each string in it’s own table.  If you just want the ‘text’ table to be a list of strings, take away the “{ }” that surrounds each of those strings.  

Then print(text[1])    print(text[2])  and so on.

Aaah so easy. Thank you guys!!!

The way you’ve set it up, the second string is text[2][1], not text[1][2]

You have each string in it’s own table.  If you just want the ‘text’ table to be a list of strings, take away the “{ }” that surrounds each of those strings.  

Then print(text[1])    print(text[2])  and so on.

Aaah so easy. Thank you guys!!!