This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Rwkeith's profile picture

Index Expected, got Nil.

Started by Rwkeith, 06 January 2013 - 09:09 AM
Rwkeith #1
Posted 06 January 2013 - 10:09 AM
I'm assigning values to an array. However, my for loop doesn't seem to be working right.


for o=1,size do
    textTable[o] = string.sub(text,o,o)
end

I've tested my size variable. That's fine. I've also tried to use string.sub(text,o,o), but that gives me a similar error. However, I can assign it to a variable and print the variable. Any advice would be appreciated.
Rwkeith #2
Posted 06 January 2013 - 10:11 AM
Fixed my problem right after posting. Apparently the website I was reading on tables made a big mistake when they said you didn't need to declare tables.

All I needed was textTable = {}