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

Reading text from file

Started by leo.chadvader, 04 April 2012 - 07:58 PM
leo.chadvader #1
Posted 04 April 2012 - 09:58 PM
I am trying to read text from a file in CraftOS.

Here is my code:

h = fs.open("settings.cfg", "r")
text = h.readLine()
h.close()
print(text)

I get an attempt to index ? error. What do I do?
Thanks.
Advert #2
Posted 04 April 2012 - 10:13 PM
You should read this: http://www.computercraft.info/forums2/index.php?/forum-11/announcement-1-forum-guidelines/